Muvuka 1 Posted June 10 Share Posted June 10 (edited) EU NÃO SEI SE É REFLECT STONE OU SE ALGO DODGE CRITICAL BOOSTER ATTACK STONE MAIS TA DANDO ERRO NO REVIVE SOMENTE [10/06/2024 00:46:08] [Error - Npc interface] [10/06/2024 00:46:08] data/npc/scripts/reviver.lua:onThink [10/06/2024 00:46:08] Description: [10/06/2024 00:46:08] (luaGetCreatureName) Creature not found [10/06/2024 00:46:08] [Error - Npc interface] [10/06/2024 00:46:08] data/npc/scripts/reviver.lua:onThink [10/06/2024 00:46:08] Description: [10/06/2024 00:46:08] data/npc/lib/npcsystem/npchandler.lua:301: bad argument #3 to 'gsub' (string/function/table expected) [10/06/2024 00:46:08] stack traceback: [10/06/2024 00:46:08] [C]: in function 'gsub' [10/06/2024 00:46:08] data/npc/lib/npcsystem/npchandler.lua:301: in function 'parseMessage' [10/06/2024 00:46:08] data/npc/lib/npcsystem/npchandler.lua:538: in function 'onWalkAway' [10/06/2024 00:46:08] data/npc/lib/npcsystem/npchandler.lua:473: in function 'onThink' [10/06/2024 00:46:08] data/npc/scripts/reviver.lua:16: in function <data/npc/scripts/reviver.lua:16> local MONEY_AMOUNT = 1000000 --Quantidade de dinheiro (em gold coins) que o player necessitará para reviver local MAGIC_EFFECT_TELEPORT = 65 -- Efeito que aparecerá quando o player for teleportado local PLAYER_REBORN_POSITION_X = 66541 local PLAYER_REBORN_POSITION_Y = 66542 local PLAYER_REBORN_POSITION_Z = 66543 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 if(msgcontains(msg, 'reviver') or msgcontains(msg, 'revive')) then selfSay('Voce precisa de ' .. MONEY_AMOUNT .. ' gold(s) para ressuscitar no local aonde voce morreu recentemente', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(getPlayerMoney(cid) >= MONEY_AMOUNT) then doPlayerRemoveMoney(cid, MONEY_AMOUNT) if teleportPlayerToPositionReborn(cid) then doTeleportThing(cid, { x=playerRebornPositionX, y=playerRebornPositionY, z=playerRebornPositionZ }) doSendMagicEffect(getThingPos(cid), MAGIC_EFFECT_TELEPORT) selfSay('Ok, voce foi ressuscitado', cid) end else selfSay('Desculpe, mais voce nao possui o dinheiro suficiente.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then talkState[talkUser] = 0 selfSay('Ok, ate mais.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) function teleportPlayerToPositionReborn(cid) local playerRebornPositionX = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_X) local playerRebornPositionY = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Y) local playerRebornPositionZ = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Z) if (playerRebornPositionX <= -1 or playerRebornPositionY <= -1 or playerRebornPositionZ <= -1) then selfSay('Voce nao morreu nenhuma vez ainda.', cid) return false end doTeleportThing(cid, { x=playerRebornPositionX, y=playerRebornPositionY, z=playerRebornPositionZ }) return true end Edited June 10 by Muvuka Link to comment Share on other sites More sharing options...
1 El Rusher 36 Posted June 11 Share Posted June 11 local MONEY_AMOUNT = 1000000 -- Quantidade de dinheiro (em gold coins) que o player necessitará para reviver local MAGIC_EFFECT_TELEPORT = 65 -- Efeito que aparecerá quando o player for teleportado local PLAYER_REBORN_POSITION_X = 66541 local PLAYER_REBORN_POSITION_Y = 66542 local PLAYER_REBORN_POSITION_Z = 66543 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 if msgcontains(msg, 'reviver') or msgcontains(msg, 'revive') then selfSay('Você precisa de ' .. MONEY_AMOUNT .. ' gold(s) para ressuscitar no local onde você morreu recentemente', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerMoney(cid) >= MONEY_AMOUNT then doPlayerRemoveMoney(cid, MONEY_AMOUNT) if teleportPlayerToPositionReborn(cid) then doTeleportThing(cid, {x = PLAYER_REBORN_POSITION_X, y = PLAYER_REBORN_POSITION_Y, z = PLAYER_REBORN_POSITION_Z}) doSendMagicEffect(getCreaturePosition(cid), MAGIC_EFFECT_TELEPORT) selfSay('Ok, você foi ressuscitado', cid) end else selfSay('Desculpe, mas você não possui dinheiro suficiente.', cid) end talkState[talkUser] = 0 elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then talkState[talkUser] = 0 selfSay('Ok, até mais.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) function teleportPlayerToPositionReborn(cid) local playerRebornPositionX = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_X) local playerRebornPositionY = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Y) local playerRebornPositionZ = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Z) if playerRebornPositionX == -1 or playerRebornPositionY == -1 or playerRebornPositionZ == -1 then selfSay('Você não morreu nenhuma vez ainda.', cid) return false end doTeleportThing(cid, {x = playerRebornPositionX, y = playerRebornPositionY, z = playerRebornPositionZ}) return true end Correção na Função teleportPlayerToPositionReborn: Os valores PLAYER_REBORN_POSITION_X, PLAYER_REBORN_POSITION_Y e PLAYER_REBORN_POSITION_Z devem ser usados corretamente para obter a posição armazenada do jogador. Correção na Lógica de Teleporte: A função doTeleportThing é chamada uma vez no teleportPlayerToPositionReborn e não precisa ser chamada novamente na função principal. Adição de Mensage Muvuka 1 Link to comment Share on other sites More sharing options...
0 Muvuka 1 Posted June 11 Author Share Posted June 11 OK @Holograma SE NÃO APARECE ERRO NO CONSOLE EU APROVO! Link to comment Share on other sites More sharing options...
Question
Muvuka 1
EU NÃO SEI SE É REFLECT STONE OU SE ALGO DODGE CRITICAL BOOSTER ATTACK STONE MAIS TA DANDO ERRO NO REVIVE SOMENTE
Link to comment
Share on other sites
2 answers to this question
Recommended Posts