
Tudo que Vodkart postou
-
(Resolvido)Bug exp rate do servidor
n copei td kk https://pastebin.com/raw/Xnhp2fCB
-
(Resolvido)Bug exp rate do servidor
testa esse mod e ve se adc 50% de exp https://pastebin.com/raw/9g3qg6h1
-
(Resolvido)AJUDA RAPIDA!
function onUse(cid, item, fromPosition, itemEx, toPosition) local config = { s = 11126, -- storage level = 8, -- level minimo time = 1100, -- tempo em minutos para voltar a abrir a chest item = {{7590, 10},{2173, 1},{7589, 10},{7620, 10},{7591, 10},{7588, 10},{7618, 10},{8472, 10},{8473, 10},{2789, 25},{2160, 1},{2152, 25},{2639, 1},{8306, 25},{2268, 25},{2273, 25},{2274, 25},{2214, 1},{2165, 1} } -- items sortiados(pode adicionar mais) } if getPlayerLevel(cid) < config.level then return doPlayerSendCancel(cid, "Você deve ter pelo menos level ".. config.level .." para abrir a Chest.") elseif getPlayerStorageValue(cid, config.s) >= os.time() then local minutos = math.floor((getPlayerStorageValue(cid, config.s) - os.time())/(60)) return doPlayerSendTextMessage(cid, 25, "You already got your reward today, wait ".. (minutos < 0 and 0 or minutos) .." minuts to pick up again.") end local r = math.random(7, #config.item) local item, amount = config.item[r][1], config.item[r][2] doPlayerAddItem(cid, item, amount) doPlayerSendTextMessage(cid, 25, "You Received ".. amount .." "..getItemNameById(item)..", congratulations!") setPlayerStorageValue(cid, config.s, os.time()+config.time*60) doSendMagicEffect(getPlayerPosition(cid), 30) doPlayerSendTextMessage(cid, 22, "You daily reward !") return true end
-
(Resolvido)Task System
<?xml version="1.0" encoding="UTF-8"?> <mod name="Simple Task" version="1.0" enabled="yes"> <config name="task_func"> <![CDATA[ monstertable = { ["troll"] = {monster = {"troll", "frost troll", "furious troll", "island troll", "swamp troll", "troll champion", "troll legionnaire"}, startStorage = 200201, storage = 91001, count = 20, experience = 150, money = 300, reward = {{2160, 2}, {2389, 10}}}, ["goblin"] = {monster = {"goblin", "goblin assassin", "goblin leader"}, startStorage = 200202, storage = 91002, count = 30, experience = 200, money = 150, reward = {{1294, 20}}} } function isSummon(cid) return getCreatureMaster(cid); end function checkTask(cid) for k, v in pairs(monstertable) do if getPlayerStorageValue(cid, v.startStorage) >= 1 then return true end end return false end function getItemsFromList(items) local str = '' if table.maxn(items) > 0 then for i = 1, table.maxn(items) do str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1]) if i ~= table.maxn(items) then str = str .. ', ' end end end return str end function GiveRewardsTask(cid, items) local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID for _, i_i in ipairs(items) do local item, amount = i_i[1],i_i[2] if isItemStackable(item) or amount == 1 then doAddContainerItem(backpack, item, amount) else for i = 1, amount do doAddContainerItem(backpack, item, 1) end end end end function HavePlayerPosition(cid, from, to) return isInRange(getPlayerPosition(cid), from, to) and true or false end ]]> </config> <event type="login" name="TaskLogin" event="script"> <![CDATA[ function onLogin(cid) registerCreatureEvent(cid, "KillTask") return true end ]]> </event> <event type="kill" name="KillTask" event="script"> <![CDATA[ domodlib('task_func') function onKill(cid, target, lastHit) if isMonster(target) and not isSummon(target) then local n = string.lower(getCreatureName(target)) for task, mob in pairs(monstertable) do if getPlayerStorageValue(cid, mob.startStorage) >= 1 then for i = 1, #mob.monster do if n == mob.monster[i] and getPlayerStorageValue(cid, mob.startStorage) >= 1 then local contagem = getPlayerStorageValue(cid, mob.storage) if (contagem == -1) then contagem = 1 end if not tonumber(contagem) then return true end if contagem > mob.count then return true end setPlayerStorageValue(cid, mob.storage, contagem+1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ""..(contagem == mob.count and "Congratulations! You finished the task of "..task.."." or "defeated. Total ["..contagem.."/"..mob.count.."] "..task..".").."") end end end end end return true end ]]> </event> </mod> ------------------ domodlib('task_func') local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local msg = string.lower(msg) if isInArray({"task", "tasks"}, msg) then selfSay("Tell me what the monster's name wants to do the task?", cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if monstertable[msg] then if checkTask(cid) ~= true then local contagem = getPlayerStorageValue(cid, monstertable[msg].storage) if(contagem == -1) then contagem = 1 end if not tonumber(contagem) then selfSay("Sorry, but you're done with the "..msg..".", cid) talkState[talkUser] = 0 return true end setPlayerStorageValue(cid, monstertable[msg].startStorage, 1) selfSay("Congratulations, you are now participating in the "..msg.." task, "..monstertable[msg].count.." "..msg.." left for you to kill.", cid) talkState[talkUser] = 0 else selfSay("Sorry, but you are already part of a task.", cid) talkState[talkUser] = 0 end else selfSay("Enter the correct task name.", cid) talkState[talkUser] = 0 end elseif msgcontains(msg, "reward") then if checkTask(cid) then for k, v in pairs(monstertable) do if getPlayerStorageValue(cid, v.startStorage) >= 1 then local contagem = getPlayerStorageValue(cid, v.storage) if (contagem == -1) then contagem = 1 end if not tonumber(contagem) then selfSay("You can only receive items only once.", cid) return true end if (((contagem) -1) >= v.count) then local str = "" if v.experience ~= nil then doPlayerAddExp(cid, v.experience) str = str.."".. (str == "" and "" or ",").. " "..v.experience.." of experience" end if v.money ~= nil then doPlayerAddMoney(cid, v.money) str = str.."".. (str == "" and "" or ",").." "..v.money.." golds" end if v.reward ~= nil then GiveRewardsTask(cid, v.reward) str = str.."".. (str == "" and "" or ", ") ..""..getItemsFromList(v.reward) end selfSay("Thanks for your help, you received "..(str == "" and "none" or ""..str.."").." for completing the task of the "..k..".", cid) setPlayerStorageValue(cid, v.storage, "Finished") setPlayerStorageValue(cid, v.startStorage, 0) setPlayerStorageValue(cid, 521456, getPlayerStorageValue(cid, 521456) == -1 and 1 or getPlayerStorageValue(cid, 521456) + 1) else selfSay("Sorry, but you only killed "..((contagem)-1).." of "..v.count.." "..k..".", cid) end end end else selfSay("You are not participating in any task.", cid) end elseif msgcontains(msg, "leave") then if checkTask(cid) then talkState[talkUser] = 2 for k, v in pairs(monstertable) do if getPlayerStorageValue(cid, v.startStorage) >= 1 then storagesair = v.startStorage local contagem = getPlayerStorageValue(cid, v.storage) if (contagem == -1) then contagem = 1 end if not tonumber(contagem) then selfSay("You are not participating in any task.", cid) else selfSay("You are participating in a "..k.." and already has "..((contagem)-1).." dead "..k..", do you really want to leave?", cid) end end end else selfSay("You are not on any task.", cid) end elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then setPlayerStorageValue(cid, storagesair, 0) selfSay("You were successfully removed from the task!", cid) elseif msgcontains(msg, "no") then selfSay("Okay then.", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
-
(Resolvido)Bug exp rate do servidor
e você usa aquele script de double exp para premium né? aquela de onLogin local rate = 1.5 -- 50% local config = { welvip = "Voce e um jogador premium, possui "..((rate - 1)*100).."% a mais de exp do que os jogadores free's", not_vip = "Adquira sua premium em nosso site ntons.sytes.net e obtenha "..((rate - 1)*100).."% a mais de EXP!", } ..... vcoê usa esse? mas o script da potion não funciona quando você da use? porque o script da potion era pra pegar o 1.5 e somar com o 100% no teu caso, fechando 3.0, correto? qndo vc loga(premium) e usa o exp potion, ele nao sobe para 3.0?
-
[Erro] Script de Npc
local talkState = {} local focus, old_focus = 0, 0 local dice_pos = {x=32465,y=32497,z=7,stackpos=255} local player_pos = {x=32464,y=32499,z=7} local nme = "Dice" function msgcontains(txt, str) return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) end function onCreatureSay(cid, type, msg) local msg = string.lower(msg) local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local function rollDice(cid,ammount) if not isCreature(cid) then return LUA_ERROR end local value = math.random(5792, 5797) local item = getThingFromPos(dice_pos) if item and item.uid and item.uid > 0 and item.itemid >= 5792 and item.itemid <= 5797 then doTransformItem(item.uid, value) end doSendMagicEffect(dice_pos, CONST_ME_CRAPS) local rolled = value - 5791 doCreatureSay(getNpcId(), getCreatureName(getNpcId()) .. ' rolled a ' .. rolled .. '.', TALKTYPE_ORANGE_1) if rolled == ammount then local backpack = doCreateItemEx(10521) doAddContainerItem(backpack,12627,3) doAddContainerItem(backpack,12626,3) doAddContainerItem(backpack,5957,1) doAddContainerItem(backpack,10310,1) doPlayerAddItemEx(cid,backpack) doSendMagicEffect(getThingPos(cid),29) doCreatureSay(cid,gm(cid,nme,1),TALKTYPE_ORANGE_1) else doCreatureSay(cid,gm(cid,nme,2),TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid),CONST_ME_POFF) end addEvent(function() if not isCreature(cid) then return LUA_ERROR end doPlayerSetStorageValue(cid,722522,-1) doTeleportThing(cid,{x=165,y=59,z=7}) end,2000) end if isInArray({1,2,3,4,5,6},tonumber(msg)) and focus == cid then local storage = getPlayerStorageValue(cid,722522) if storage == -1 then doPlayerSetStorageValue(cid,722522,1) rollDice(cid, tonumber(msg)) end end end function onThink() local player = getTopCreature(player_pos) if player and player.uid and player.uid > 0 and isPlayer(player.uid) then if focus ~= player.uid then focus = player.uid selfSay(gm(cid,nme,3).." "..getCreatureName(player.uid)..".")? addEvent(function() if not isCreature(player.uid) then return LUA_ERROR end if isPlayer(player.uid) then doSendMagicEffect(getThingPos(player.uid),CONST_ME_POFF) doPlayerSetStorageValue(player.uid,722522.-1) doTeleportThing(player.uid,{x=165,y=59,z=7}) end end,10000) end end end
-
[Erro] Script de Npc
local talkState = {} local focus, old_focus = 0, 0 local dice_pos = {x=32465,y=32497,z=7,stackpos=255} local player_pos = {x=32464,y=32499,z=7} local nme = "Dice" function msgcontains(txt, str) return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) end function onCreatureSay(cid, type, msg) local msg = string.lower(msg) local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local function rollDice(cid,ammount) local value = math.random(5792, 5797) local item = getThingFromPos(dice_pos) if item and item.uid and item.uid > 0 and item.itemid >= 5792 and item.itemid <= 5797 then doTransformItem(item.uid, value) end doSendMagicEffect(dice_pos, CONST_ME_CRAPS) local rolled = value - 5791 doCreatureSay(getNpcId(), getCreatureName(getNpcId()) .. ' rolled a ' .. rolled .. '.', TALKTYPE_ORANGE_1) if rolled == ammount then local backpack = doCreateItemEx(10521) doAddContainerItem(backpack,12627,3) doAddContainerItem(backpack,12626,3) doAddContainerItem(backpack,5957,1) doAddContainerItem(backpack,10310,1) doPlayerAddItemEx(cid,backpack) doSendMagicEffect(getThingPos(cid),29) doCreatureSay(cid,gm(cid,nme,1),TALKTYPE_ORANGE_1) else doCreatureSay(cid,gm(cid,nme,2),TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid),CONST_ME_POFF) end addEvent(function() if not isCreature(cid) then return LUA_ERROR end doPlayerSetStorageValue(cid,722522,-1) doTeleportThing(cid,{x=165,y=59,z=7}) end,2000) end if isInArray({1,2,3,4,5,6},tonumber(msg)) and focus == cid then local storage = getPlayerStorageValue(cid,722522) if storage == -1 then doPlayerSetStorageValue(cid,722522,1) rollDice(cid,tonumber(msg)) end end end function onThink() local player = getTopCreature(player_pos) if player and player.uid and player.uid > 0 and isPlayer(player.uid) then if focus ~= player.uid then focus = player.uid selfSay(gm(cid,nme,3).." "..getCreatureName(player.uid)..".") addEvent(function() if not isCreature(player.uid) then return LUA_ERROR end if isPlayer(player.uid) then doSendMagicEffect(getThingPos(player.uid),CONST_ME_POFF) doPlayerSetStorageValue(player.uid,722522.-1) doTeleportThing(player.uid,{x=165,y=59,z=7}) end end,10000) end end end
-
[Comando] Comando para add item ao player mesmo off
additemdepot.lua function doPlayerAddDepotItems(pid, item, count) --By magus and edited by vodkart local item,count = {item},{(count or 1)} for k,v in ipairs(item) do local ls = db.getResult("SELECT `sid` FROM `player_depotitems` WHERE `player_id` = "..pid.." ORDER BY `sid` DESC LIMIT 1") return db.executeQuery("INSERT INTO `player_depotitems` (`player_id`, `sid`, `pid`, `itemtype`, `count`, `attributes`) VALUES ("..pid..", "..(ls:getDataInt("sid")+1)..", 101, "..v..", "..count[k]..", '')") or false end end function onSay(cid, words, param) local t = string.explode(param:lower(),",") if not t[1] then doPlayerSendCancel(cid, "digite Nome, Item ID, quantidade.") return true elseif not getPlayerByNameWildcard(t[1]) and not getPlayerGUIDByName(t[1]) then doPlayerSendCancel(cid, "Você deve digitar um Nome Válido.") return true elseif not tonumber(t[2]) or not tonumber(t[3]) or tonumber(t[3]) < 1 or tonumber(t[3]) > 999 or not isItemStackable(t[2]) and tonumber(t[3]) > 10 then doPlayerSendCancel(cid, "você deve digitar NOME,ID,QUANTIDADE(maior que 0"..(not isItemStackable(t[2]) and " até 10 se não for empilhavel." or " até 1000 se for empilhavel.")..").") return true elseif not isItemMovable(t[2]) or not getItemNameById(tonumber(t[2])) then doPlayerSendCancel(cid, "Este item não existe ou não pode ser adicionado ao jogador.") return true end local player = getPlayerByNameWildcard(t[1]) if player then parcel = doCreateItemEx(ITEM_PARCEL) if isItemStackable(t[2]) or tonumber(t[3]) == 1 then doAddContainerItem(parcel, t[2], t[3]) else for i = 1, t[3] do doAddContainerItem(parcel, t[2], 1) end end doPlayerSendMailByName(getPlayerNameByGUID(getPlayerGUIDByName(t[1])), parcel, 1) else local getPlayer = getPlayerGUIDByName(t[1]) if isItemStackable(t[2]) or tonumber(t[3]) == 1 then doPlayerAddDepotItems(getPlayer, t[2], t[3]) else for i = 1, t[3] do doPlayerAddDepotItems(getPlayer, t[2], 1) end end end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"você adicionou "..t[3].." "..getItemNameById(t[2]).." ao depot do jogador "..t[1]) return true end TAG <talkaction log="yes" access="5" words="/adddepot" event="script" value="additemdepot.lua"/> Exemplo: /adddepot vodkart,2160,500 or /adddepot vodkart,2494,6 postei isso em 2013 acho la na otland kk https://otland.net/threads/add-items-depot-from-player-online-offline.196947/
-
(Resolvido)Bug exp rate do servidor
posso dar uma olhada no seu script de exp potion e config.lua?
-
NPC de Troca AJUDA
Veja se você tem essas funções na lib, se não tiver as coloque! function getItemsFromList(items) local str = '' if table.maxn(items) > 0 then for i = 1, table.maxn(items) do str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1]) if i ~= table.maxn(items) then str = str .. ', ' end end end return str end function doRemoveItemsFromList(cid,items) local count = 0 if table.maxn(items) > 0 then for i = 1, table.maxn(items) do if getPlayerItemCount(cid,items[i][1]) >= items[i][2] then count = count + 1 end end end if count == table.maxn(items) then for i = 1, table.maxn(items) do doPlayerRemoveItem(cid,items[i][1],items[i][2]) end else return false end return true end ------------------------------- Data/npc Aldro Forjador.xml <?xml version="1.0"?> <npc name="Aldro Forjador" script="data/npc/scripts/forjar_itens.lua" walkinterval="50000" floorchange="0"> <health now="100" max="100"/> <look type="129" head="95" body="116" legs="121" feet="115" addons="3"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|.Eu posso forjar alguns {itens} itens para voce!" /> </parameters> </npc> Data/npc/scripts forjar_itens.lua local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function doChangeWeapon(cid, message, keywords, parameters, node) -- by vodka if(not npcHandler:isFocused(cid)) then return false end if (isPlayerPremiumCallback == nil or isPlayerPremiumCallback(cid) == true or parameters.premium == false) then if(parameters.level ~= nil and getPlayerLevel(cid) < parameters.level) then npcHandler:say('Desculpe, voce precisa ter level ' .. parameters.level .. ' ou mais para forjar este item.', cid) elseif not doRemoveItemsFromList(cid,parameters.items) then npcHandler:say('Desculpe, mas voce não tem '..getItemsFromList(parameters.items)..' para forjar este item!', cid) else local r = parameters.chance local v = math.random(1, 100) if r > v then npcHandler:say('Sucesso! Aqui esta seu item.', cid) doPlayerAddItem(cid,parameters.give,1) doSendMagicEffect(getPlayerPosition(cid), math.random(28,30)) else npcHandler:say('Desculpe, mas seu item falho na forja!', cid) doSendMagicEffect(getPlayerPosition(cid), 2) end npcHandler:resetNpc() end else npcHandler:say('Desculpe, mas apenas forjo esse item para jogadores premium account.', cid) end npcHandler:resetNpc() return true end local list = { {"demon armor", items = {{2466,3},{2160,2}}, item_give = 2494, chance = 30, level = 10, premium = false}, {"solar axe", items = {{2432,10},{2160,5},{8924,1}}, item_give = 8925, chance = 50, level = 15, premium = true}, {"broadsword", items = {{2376,10},{2160,2}}, item_give = 2413, chance = 90, level = 15, premium = false}, {"magic longsword", items = {{2400,5},{2393,5},{2160,5}}, item_give = 2390, chance = 90, level = 25, premium = false}, {"ice rapier", items = {{7449,2},{2160,5}}, item_give = 2396, chance = 10, level = 25, premium = false}, {"itens", text = "Eu posso te forjar alguns itens como: {demon armor},{solar axe},{broadsword} ou {magic longsword}!"} } for i = 1, #list do local get = list[i] if type(get.items) == "table" then local node = keywordHandler:addKeyword({get[1]}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Para forjar o item " .. get[1] .. " é necessário "..getItemsFromList(get.items)..". Você tem tudo isso para me dar?"}) node:addChildKeyword({"yes"}, doChangeWeapon, {items = get.items, give = get.item_give, chance = get.chance, level = get.level, premium = get.premium}) node:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "tudo bem entao.", reset = true}) else keywordHandler:addKeyword({get[1]}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = get.text}) end end mounts = nil npcHandler:addModule(FocusModule:new()) explicando: na tabela "list" existe essa linha por exemplo: {"demon armor", items = {{2466,3},{2160,2}}, item_give = 2494, chance = 30, level = 10, premium = false}, "nome do item que vai ser trocado" ------------------------------------- items = {} -- tabela de itens que vai ser preciso dar ao npc pra trocar de itens coloque assim -- > {{itemid,quantidade}} para mais de um item -- > {{itemid, quantidade},{itemid, quantidade}} exemplo que eu botei: items = {{2466,3},{2160,2}} -- 3 golden armor e 2 crystal coin --------------------------------------------------- item_give -- aqui é o id final do item que vai ser dado ao jogador ----------------------------------------------- chance -- é a chance de a forja dar certo, quanto maior a chance maior a chance de dar certoa forja do iten ------------------------------------ level -- é para forjar o item ---------------------------- premium -- se precisa ser premium pra forjar o itens em questao, true ou false.
-
(Resolvido)[Erro] NPC ajudem please!!
mas no seu tbm não estava, por isso que coloquei para não remover!! local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser,msg = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower() local tabble = { ["carlin"] = {item = {2160,1}, money = 1, level = 30, pos = {x = 1054, y = 1058, z = 7}}, ["thais"] = {item = {2190, 1}, money = 2000, level = 60, pos = {x = 168, y = 58, z = 7}} } if not tabble[msg] then npcHandler:say('somente posso te levar para {carlin} ou {thais}...', cid) return true end local t = tabble[msg] if getPlayerItemCount(cid, t.item[1]) >= t.item[2] then if getPlayerLevel(cid) >= t.level then if getPlayerMoney(cid) >= t.money then npcHandler:say('Você foi teleportado para '..msg..'!', cid) doTeleportThing(cid, t.pos) doPlayerRemoveItem(cid,t.item[1],t.item[2]) doPlayerRemoveMoney(cid, t.money) return true else npcHandler:say('Você precisa de '..t.money..' gold coins para viajar para '..msg..'.', cid) end else npcHandler:say('Você precisa ter '..t.level..' level ou mais para viajar para '..msg..'.', cid) end else npcHandler:say('Você precisa de '..t.item[2]..' '..getItemNameById(t.item[1])..' para viajar para '..msg..'.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
-
NPC de Buy e Sell no modo antigo
@TibiaParadise funciona sim, eu testei aqui... Acontece que o box code do fórum buga o script sobre editar o NPC XML, ele não vai responder como você colocou. usa assim: Obi.xml https://pastebin.com/raw/PKfAhjxU e o script: oldbuyer.lua https://pastebin.com/raw/jMraP6nW ------------------------------------------------------------ ------------------------------------------------------------ o que é o npcold.lua ? nem postei isso. edit -- vc trocou o nome do arquivo, entendi. enfim, usa os arquivos que te passei no pastebin
- Procuro participação em projetos
-
(Resolvido)Premium
troca function getPremiumGift(player) local query = db.storeQuery("SELECT `premiumgift` FROM `accounts` WHERE `id = "..player:getAccountId()) return result.getDataInt(query, "premiumgift") > 0 and true or false end por function getPremiumGift(player) local query = db.storeQuery("SELECT `premiumgift` FROM `accounts` WHERE `id` = "..player:getAccountId()) return result.getDataInt(query, "premiumgift") > 0 and true or false end
-
CODES bugando os códigos
olhem o último post do @Emanueldk, com ele tbm acontece esse erro.
-
(Resolvido)Premium
executa no seu banco de dados: ALTER TABLE `accounts` ADD `premiumgift` INT NOT NULL DEFAULT '0' usa o script assim: function getPremiumGift(player) local query = db.storeQuery("SELECT `premiumgift` FROM `accounts` WHERE `id` = "..player:getAccountId()) return result.getDataInt(query, "premiumgift") > 0 and true or false end local config = {level = 30, days = 7} function onAdvance(player, oldlevel, newlevel) if player:getLevel() >= config.level and not getPremiumGift(player) then player:addPremiumDays(config.days) player:sendTextMessage(MESSAGE_INFO_DESCR, "Você ganhou "..config.days.." dias de premium por alcançar level "..config.level.." em pelo menos um char de sua account. Você não irá ganhar de novo caso upe level "..config.level.." em outro char para pegar sua premium basta relogar.") db:query("UPDATE `accounts` SET `premiumgift` = 1 WHERE `id` = "..player:getAccountId()) end return true end caso não der certo troque essa linha: db:query("UPDATE `accounts` SET `premiumgift` = 1 WHERE `id` = "..player:getAccountId()) por db.query("UPDATE `accounts` SET `premiumgift` = 1 WHERE `id` = "..player:getAccountId()) ou db.asyncQuery("UPDATE `accounts` SET `premiumgift` = 1 WHERE `id` = "..player:getAccountId())
-
NPC de Buy e Sell no modo antigo
e seu servidor é 8.60? pra fzr um npc desse vai precisar de uma gambiarrinha kk ------------------------------------------------------------------------------------- data > npc > lib crie um arquivo.lua e renomei para npc-func.lua local focuses = {} function isFocused(cid, t) for i, v in pairs(t) do if(v == cid) then return true end end return false end function addFocus(cid, t) if(not isFocused(cid, t)) then table.insert(t, cid) end end function setFocus(t) for i, v in pairs(t) do if(isPlayer(v)) then doNpcSetCreatureFocus(v) return end end doNpcSetCreatureFocus(0) end function removeFocus(cid, t) for i, v in pairs(t) do if(v == cid) then table.remove(t, i) setFocus(focuses) break end end end function onCreatureDisappear(cid) if isFocused(cid, focuses) then removeFocus(cid, focuses) if isPlayer(cid) then closeShopWindow(cid) end end end -------------------------- data > npc nome do seu npc.xml <?xml version="1.0" encoding="UTF-8"?> <npc name="nome do seu npc" script="oldbuyer.lua" walkinterval="5000" floorchange="0"> <health now="100" max="100"/> <look type="133" head="114" body="119" legs="132" feet="114"/> </npc> data > npc > scripts oldbuyer.lua dofile("data/npc/lib/npc-func.lua") local focuses = {} -- do not change local shop = { [{"axe", "axes"}] = {id=2386, buy = 20 , sell= 8}, -- id do item, por quanto ele vai comprar e por quanto ele vai vender, se colocar 0 ele n vende ou se colocar 0 nao compra o item [{"club", "clubs"}] = {id=2382, buy = 20 , sell= 8}, [{"broadsword", "broadswords"}] = {id=2413, buy = 100 , sell= 0}, [{"mastermind shield","mastermind shields"}] = {id=2514, buy = 50000 , sell= 30000}, [{"demon backpack","demon backpacks"}] = {id=10518, buy = 10000 , sell= 5000}, [{"scarab coin","scarab coins"}] = {id=2159, buy = 50 , sell= 30} } function onBuy(cid, item, amount, price) if amount <= 100 then if doPlayerRemoveMoney(cid, price) then if isItemStackable(item) or amount == 1 then doPlayerAddItem(cid, item, amount) else for i = 1, amount do doPlayerAddItem(cid, item, 1) end end selfSay('Here your item(s)!', cid) talk_step = 1 else selfSay('You need '..price..' Gold Coins!', cid) talk_step = 1 end else selfSay('You have buy a maximum of 100 items at a time.', cid) talk_step = 1 end return true end function onSell(cid, item, amount, price) if amount <= 100 then if doPlayerRemoveItem(cid, item, amount) then doPlayerAddMoney(cid, price) selfSay('Here is '..price..' Gold Coins.', cid) talk_step = 1 else selfSay('Sorry, but you no have '..amount..' '..getItemNameById(item)..' for sell!', cid) talk_step = 1 end else selfSay('You have to sell a maximum of 100 items at a time.', cid) talk_step = 1 end return true end function onCreatureSay(cid, type, msg) local cid_Say = msg:lower() if ((cid_Say == "hi") and not (isFocused(cid, focuses))) then selfSay("Hello, "..getCreatureName(cid).."! what you want for me? I'm selling and buying some itens...", cid) addFocus(cid, focuses) selfFocus(cid) talk_step = 1 elseif talk_step == 1 and cid_Say == "bye" then selfSay('bye '..getCreatureName(cid)..'!', cid) removeFocus(cid, focuses) elseif talk_step == 1 then local t,ret = {},0 for var in string.gmatch(cid_Say, "[^%s]+") do ret = ret +1 if ret < 3 then table.insert(t, var) else t[3] = (t[3] == nil and var or t[3].. " "..var) end end if not isInArray({"buy", "sell"}, t[1]) then selfSay('just buy and sell items, be right!', cid) return true end notSellOrBuy = false for var, ret in pairs(shop) do for _, check in pairs(var) do if t[3] == check then type,pos,name = ret.type,ret.pos,ret.name itemid, amount, tipo = ret.id, tonumber(t[2]), t[1] price = (t[1] == "buy" and ret.buy*amount or ret.sell*amount) if t[1] == "sell" and ret.sell == 0 then return selfSay('Sorry, I do not want to buy this item at the moment!', cid) elseif t[1] == "buy" and ret.buy == 0 then return selfSay('Sorry, I do not want sell this item at the moment!', cid) elseif not tonumber(t[2]) then return selfSay('say amount!! ex: buy 2 axes.', cid) end selfSay('You want to '..(t[1] == 'buy' and 'buy' or 'sell')..' '..amount..' '..t[3]..' for '..price..' Gold Coins?.', cid) talk_step = 2 notSellOrBuy = true break end end end if not notSellOrBuy then selfSay('Sorry, I do not buy or sell this item.', cid) end elseif talk_step == 2 and cid_Say == "yes" then if tipo == 'buy' then onBuy(cid, itemid, amount, price) else onSell(cid, itemid, amount, price) end elseif talk_step == 2 and cid_Say == "no" then selfSay('Then ok... Bye!', cid) removeFocus(cid, focuses) talk_step = 0 end return true end function onThink() for _, focus in pairs(focuses) do if not isCreature(focus) then removeFocus(focus, focuses) talk_step = 0 else local distance = getDistanceTo(focus) or 5 if distance > 4 then selfSay("Hmpf!", focus) removeFocus(focus, focuses) talk_step = 0 end end end setFocus(focuses) end
-
(Resolvido)[Erro] NPC ajudem please!!
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser,msg = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower() local tabble = { ["carlin"] = {item = {2160,1}, money = 1, level = 30, pos = {x = 1054, y = 1058, z = 7}}, ["thais"] = {item = {2190, 1}, money = 2000, level = 60, pos = {x = 168, y = 58, z = 7}} } if not tabble[msg] then npcHandler:say('somente posso te levar para {carlin} ou {thais}...', cid) return true end local t = tabble[msg] if getPlayerItemCount(cid, t.item[1]) >= t.item[2] then if getPlayerLevel(cid) >= t.level then if getPlayerMoney(cid) >= t.money then npcHandler:say('Você foi teleportado para '..msg..'!', cid) doTeleportThing(cid, t.pos) doPlayerRemoveMoney(cid, t.money) return true else npcHandler:say('Você precisa de '..t.money..' gold coins para viajar para '..msg..'.', cid) end else npcHandler:say('Você precisa ter '..t.level..' level ou mais para viajar para '..msg..'.', cid) end else npcHandler:say('Você precisa de '..t.item[2]..' '..getItemNameById(t.item[1])..' para viajar para '..msg..'.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) testado.
-
(Resolvido)[Erro] NPC ajudem please!!
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser,msg = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower() local tabble = { ["carlin"] = {item = {2160,1}, money = 1, level = 30, pos = {x = 1054, y = 1058, z = 7}}, ["thais"] = {item = {2190, 1}, money = 2000, level = 60, pos = {x = 168, y = 58, z = 7}} } if not tabble[msg] then npcHandler:say('somente posso te levar para {carlin} ou {thais}...', cid) return true end local t = tabble[msg] if getPlayerItemCount(cid, t.item[1]) >= t.item[2] then if getPlayerLevel(cid) >= t.level then if getPlayerMoney(cid) >= t.money then npcHandler:say('Você foi teleportado para '..msg..'!', cid) doTeleportThing(cid, t.pos) doPlayerRemoveMoney(cid, t.money) return true else npcHandler:say('Você precisa de '..t.money..' gold coins para viajar para '..msg..'.', cid) end else npcHandler:say('Você precisa ter '..t.level..' level ou mais para viajar para '..msg..'.', cid) end else npcHandler:say('Você precisa de '..t.item[2]..' '..getItemNameById(t.item[1])..' para viajar para '..msg..'.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
-
CODES bugando os códigos
ainda está bugado, testei agora. mas eu estava vendo se usar "sem realce de sintaxe" não buga
-
[8.60] Teleportes Falantes Em Laranja
Resolvendo a dúvida deste tópico: Resolvi postar para que possa ajudar futuros membros. Resultado: Código: nome do seu script.lua local positions = { {texto = "CTF" , pos = {x = 180, y = 48, z = 7}}, {texto = "Battle F." , pos = {x = 184, y = 48, z = 7}}, {texto = "DesertWar" , pos = {x = 184, y = 57, z = 7}}, {texto = "Castle24H" , pos = {x = 157, y = 62, z = 7}}, {texto = "Castle48H" , pos = {x = 175, y = 62, z = 7}}, {texto = "TeamBattle" , pos = {x = 176, y = 56, z = 7}}, {texto = "Campo M." , pos = {x = 177, y = 56, z = 7}}, {texto = "FireStorm" , pos = {x = 187, y = 53, z = 7}}, {texto = "IOE" , pos = {x = 175, y = 56, z = 7}}, {texto = "rank" , pos = {x = 60, y = 122, z = 7}}, {texto = "Boss Room" , pos = {x = 187, y = 51, z = 7}}, {texto = "Leia" , pos = {x = 182, y = 51, z = 7}}, {texto = "RushEvent" , pos = {x = 174, y = 56, z = 7}}, {texto = "Leia" , pos = {x = 2959, y = 698, z = 6}}, {texto = "Editados" , pos = {x = 233, y = 2050, z = 4}}, {texto = "Snowball" , pos = {x = 180, y = 57, z = 7}}, {texto = "Dota" , pos = {x = 177, y = 49, z = 7}} } function onThink(cid, interval, lastExecution) for _, pid in pairs(positions) do local t = getSpectators(pid.pos, 7, 5, false) if t then for _, cid in ipairs(t) do if isPlayer(cid) then doCreatureSay(cid, pid.texto, TALKTYPE_ORANGE_1, false, cid, pid.pos) end end end end return true end colocar o Texto e depois a pos de onde vai sair o texto!! TAG <globalevent name="OrangeTalk" interval="3" script="nome do seu script.lua"/> caso seu servidor seja em milesegundos, alterar o "3" por "3000" abraços
-
Ajuda erro creaturescripts
vc n tem as outras funções adc no seu script function doItemAddExp(item) if item.itemid > 0 then return doItemSetAttribute(item.uid, "exp", getItemExp(item) + 1) end return false end function doItemAddLevel(item, count) if item.itemid > 0 and tonumber(count) then return doItemSetAttribute(item.uid, "level", getItemLevel(item) + count) end return false end
-
Illegal Value
Este tópico foi movido para a área correta. Esta é uma mensagem automática! Pedimos que leia as regras do fórum!
-
Ajuda erro creaturescripts
local min_exp = 2000 local exp_levels = {100000, 245000, 499500, 743300, 967000, 1317400, 2038000, 3800000, 5214000, 7130000} local slots = {1,4,7,8,5,6} local wands = {7735,7414,7410,7424} local function getItemExp(item) if item.itemid > 0 then return getItemAttribute(item.uid, "exp") or tonumber(0) end return false end local function getItemLevel(experience) if experience < exp_levels[1] then return tonumber(0) end local old = 1 for i = 2,10 do if experience < exp_levels and experience >= exp_levels[old] then return tonumber(old) end old = i end end local function getMonsterItemExp (cid,monsterExp) local n = monsterExp * 2.71828182846 local lvl = getPlayerLevel(cid) n = (n / (lvl ^ (2.71828182846/10)))/1000 return math.floor(n) end function onKill(cid, target, lastHit) if isPlayer(cid) and isMonster(target) then local name = getCreatureName(target) local monsterExp = getMonsterInfo(name).experience local exp_gain = getMonsterItemExp(cid, monsterExp) if monsterExp >= min_exp then for _,b in pairs(slots) do local item = getPlayerSlotItem(cid, b) if item.uid > 0 then if isArmor(item.itemid) or isShield(item.uid) or isWand(item.uid) or isAxe(item.uid) or isSword(item.uid) or isClub(item.uid) or isBow(item.uid) then doItemAddExp(cid, item, exp_gain) local itemExp = getItemExp(item) --doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT,"Seu "..getItemNameById(item.itemid).." ganhou "..exp_gain.." pontos de exp ao derrotar um "..name..". Ele tem ["..itemExp.."/".. exp_levels[ getItemLevel(itemExp) +1] .."] pontos atualmente.") end end end end end return true end function onLogin(cid) registerCreatureEvent(cid, "Item level") return true end
-
[ERRO] Script de Raid System
sim, mas é outra situação, já que esse código não checa se a pos que vai ser summonado o monstro está livre... digamos que teria que refazer o script inteiro. no seu caso, o math.random estava dando errado porque você configurou as positions erradas na tabela... se eu tiver um tempo eu refaço esse script do KillLua para você!! abraços