Postado Setembro 29, 2023 1 ano [28/09/2023 22:03:31] [Error - Npc interface] [28/09/2023 22:03:31] data/npc/scripts/expbuy.lua:onCreatureSay [28/09/2023 22:03:31] Description: [28/09/2023 22:03:31] data/npc/scripts/expbuy.lua:20: attempt to index global 'death_tabble' (a nil value) [28/09/2023 22:03:31] stack traceback: [28/09/2023 22:03:31] data/npc/scripts/expbuy.lua:20: in function 'callback' [28/09/2023 22:03:31] data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay' [28/09/2023 22:03:31] data/npc/scripts/expbuy.lua:7: in function <data/npc/scripts/expbuy.lua:7> expbuy.luaUnavailable Scrutinon.xmlUnavailable npchandler.luaUnavailable Editado Setembro 3, 2024 Set 3 por Muvukaa (veja o histórico de edições)
Postado Setembro 29, 2023 1 ano Diretor expbuy 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 local DEATH_TABLE = { before_exp = 0, after_exp = 0 } 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) local itemid, count = 9020, 5 -- Edit the item id and count here if isInArray({"recover", "recuperar", "exp", "experience"}, msg) then npcHandler:say("Do you want to recover lost experience after your death for " .. count .. " " .. getItemNameById(itemid) .. "? {yes}", cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, DEATH_TABLE.before_exp) ~= -1 and getPlayerExperience(cid) < getPlayerStorageValue(cid, DEATH_TABLE.before_exp) then if doPlayerRemoveItem(cid, itemid, count) == TRUE then local expToRestore = getPlayerStorageValue(cid, DEATH_TABLE.before_exp) - getPlayerStorageValue(cid, DEATH_TABLE.after_exp) doPlayerAddExp(cid, expToRestore) npcHandler:say("Thank you! Here is your experience.", cid) else npcHandler:say("Sorry, you don't have enough " .. getItemNameById(itemid) .. "!", cid) end else npcHandler:say("Sorry, you didn't die or have already recovered your lost experience.", cid) end talkState[talkUser] = 0 elseif msg == "no" then npcHandler:say("Then not.", cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) expbuy otimizado local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local DEATH_TABLE = { before_exp = 0, after_exp = 0 } 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) local itemid, count = 9020, 5 -- Edite o ID e a quantidade do item aqui if isInArray({"recover", "recuperar", "exp", "experience"}, msg) then npcHandler:say("Deseja recuperar a experiência perdida após sua morte por " .. count .. " " .. getItemNameById(itemid) .. "? {yes}", cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then local beforeExp = getPlayerStorageValue(cid, DEATH_TABLE.before_exp) local afterExp = getPlayerStorageValue(cid, DEATH_TABLE.after_exp) local playerExp = getPlayerExperience(cid) if beforeExp ~= -1 and playerExp < beforeExp then if doPlayerRemoveItem(cid, itemid, count) == TRUE then local expToRestore = beforeExp - afterExp doPlayerAddExp(cid, expToRestore) npcHandler:say("Obrigado! Aqui está sua experiência perdida de volta.", cid) else npcHandler:say("Desculpe, você não tem itens suficientes " .. getItemNameById(itemid) .. "!", cid) end else npcHandler:say("Desculpe, você não morreu ou já recuperou sua experiência perdida!", cid) end talkState[talkUser] = 0 elseif msg == "no" then npcHandler:say("Então, não.", cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Setembro 29, 2023 1 ano Autor Scrutinon: Sorry, you didn't die or have already recovered your lost experience. fica aparecendo isso eu morri tava com 5 vampire lord token e apareceu isso eu tenho death_list no banco de dados sendo que quando falei recuperar yes não deu nenhum erro no console mais não ta funcionando o segundo script nao funciona se fala hi ele nao tem nenhuma ação nao acontece nada. 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 local DEATH_TABLE = { before_exp = 0, after_exp = 0 } 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) local itemid, count = 9020, 5 -- Edit the item id and count here if isInArray({"recover", "recuperar", "exp", "experience"}, msg) then npcHandler:say("Do you want to recover lost experience after your death for " .. count .. " " .. getItemNameById(itemid) .. "? {yes}", cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, DEATH_TABLE.before_exp) ~= -1 and getPlayerExperience(cid) < getPlayerStorageValue(cid, DEATH_TABLE.before_exp) then if doPlayerRemoveItem(cid, itemid, count) == TRUE then local expToRestore = getPlayerStorageValue(cid, DEATH_TABLE.before_exp) - getPlayerStorageValue(cid, DEATH_TABLE.after_exp) doPlayerAddExp(cid, expToRestore) npcHandler:say("Thank you! Here is your experience.", cid) else npcHandler:say("Sorry, you don't have enough " .. getItemNameById(itemid) .. "!", cid) end else npcHandler:say("Sorry, you didn't die or have already recovered your lost experience.", cid) end talkState[talkUser] = 0 elseif msg == "no" then npcHandler:say("Then not.", cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Setembro 29, 2023 1 ano por Muvukaa (veja o histórico de edições)
Postado Setembro 29, 2023 1 ano Diretor Embora o script esteja funcionando corretamente, parece que a tabela no banco de dados não está registrando a experiência conforme esperado. A mensagem atual indica isso porque a tabela está com valor 0 ou nulo, impossibilitando a recuperação de experiência. Isso pode estar relacionado a outro sistema que registra a experiência do jogador no banco de dados. "Pedimos desculpas, mas você não pode recuperar a experiência perdida no momento, pois não há registro disponível!"
Postado Setembro 29, 2023 1 ano Autor EU TAVA LEVEL 25 PAREI 24 FIZ TEST NAO OCASIONO NADA. Editado Setembro 29, 2023 1 ano por Muvukaa (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.