testei e funciona direitinho, estou passando ele para o revscript está tudo certo na hora de receber o prêmio mas dps que o evento é encerrado acontece de que quando eu mato qualquer outra criatura sendo ou não da lista, aparece o seguinte erro:
Lua Script Error: [Scripts Interface]
C:\Users\Desktop\NovoUniServer\otserv - Baiak\data\scripts\creaturescripts\monsterHuntKill.lua:callback
...- Baiak\data\scripts\creaturescripts\monsterHuntKill.lua:17: attempt to index a nil value
stack traceback:
[C]: in function '__index'
...- Baiak\data\scripts\creaturescripts\monsterHuntKill.lua:17: in function <...- Baiak\data\scripts\creaturescripts\monsterHuntKill.lua:3>
SCRIPT:
local monsterHunt = CreatureEvent("monsterHunt")
function monsterHunt.onKill(player, target)
if Game.getStorageValue(MONSTER_HUNT.storages.monster) == nil then
return true
end
if not player or not target then
return true
end
if player:getStorageValue(MONSTER_HUNT.storages.player) == -1 then
player:setStorageValue(MONSTER_HUNT.storages.player, 0)
end
if target:isMonster() and target:getName():lower() == (MONSTER_HUNT.list[Game.getStorageValue(MONSTER_HUNT.storages.monster)]):lower() then
player:setStorageValue(MONSTER_HUNT.storages.player, player:getStorageValue(MONSTER_HUNT.storages.player) + 1)
player:sendTextMessage(30, MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.kill:format(player:getStorageValue(MONSTER_HUNT.storages.player), target:getName()))
table.insert(MONSTER_HUNT.players, {player:getId(), player:getStorageValue(MONSTER_HUNT.storages.player)})
end
end
monsterHunt:register()
conseguem me ajudar?