Needed a script where each creature the player kills he adds x storage, and when he kills x amount he will be teleported.
I tried to create something, but I couldn't, can someone help me?
I tried to create something, but I couldn't, can someone help me?
Lua:
local kill = CreatureEvent("KillCreature")
function kill.onKill(player, target)
if target:isPlayer() or target:getMaster() then
return true
end
if(isMonster(target)) then
local killAmount = player:getStorageValue(598626)
if(string.lower(getCreatureName(target)) == "rat") and killAmount < 4 then
player:setStorageValue(598626, killAmount + 1)
else
player:teleportTo(32371, 32233, 7)
end
end
return true
end
kill:register()