Postado Setembro 27, 2023 1 ano Scrutinon.xml <?xml version="1.0" encoding="UTF-8"?> <npc name="Scrutinon" script="data/npc/scripts/expbuy.lua" walkinterval="0" floorchange="0"> <health now="100" max="100"/> <look typeex="7825" head="7825" body="0" legs="0" feet="0" addons="0"/> <parameters> <parameter key="message_greet" value="Grande |PLAYERNAME|! Eu posso {recuperar} a exp perdida em sua morte." /> <parameter key="message_decline" value="Adios." /> </parameters> </npc> buyexp.lua 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) local itemid,count = 9020,300 -- edite o id e count do item aqui if isInArray({"recover","recuperar","exp","experience"}, msg) then npcHandler:say("você deseja recuperar a exp perdida após á sua morte por "..count.." "..getItemNameById(itemid).."? {yes}", cid) talkState[talkUser] = 1 elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if getPlayerStorageValue(cid, death_tabble.before_exp) ~= -1 and getPlayerExperience(cid) < getPlayerStorageValue(cid, death_tabble.before_exp) then if doPlayerRemoveItem(cid, itemid, count) == TRUE then local count = (getPlayerStorageValue(cid, death_tabble.before_exp) - getPlayerStorageValue(cid, death_tabble.after_exp)) doPlayerAddExp(cid, count) npcHandler:say("Obrigado! aqui está sua experiência.", cid) else npcHandler:say("Desculpe, você não tem "..getItemNameById(itemid).." suficientes!", cid) talkState[talkUser] = 0 end else npcHandler:say("Desculpe, você não morreu ou já recuperou sua exp perdida!", cid) talkState[talkUser] = 0 end elseif msg == "no" then selfSay("Then not", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) ERRO: [27/09/2023 16:43:32] [Error - Npc interface] [27/09/2023 16:43:32] data/npc/scripts/expbuy.lua:onCreatureSay [27/09/2023 16:43:32] Description: [27/09/2023 16:43:32] data/npc/scripts/expbuy.lua:20: attempt to index global 'death_tabble' (a nil value) [27/09/2023 16:43:32] stack traceback: [27/09/2023 16:43:32] data/npc/scripts/expbuy.lua:20: in function 'callback' [27/09/2023 16:43:32] data/npc/lib/npcsystem/npchandler.lua:383: in function 'onCreatureSay' [27/09/2023 16:43:32] data/npc/scripts/expbuy.lua:7: in function <data/npc/scripts/expbuy.lua:7>
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.