Lurk
Active Member
- Joined
- Dec 4, 2017
- Messages
- 336
- Reaction score
- 49
I have this script that works in a loop, but if the player is kiked at the 7th loop for example, I'll still receive like 13 errors in the console telling me that the player couldn't be found. Is there a
script:
console error
if getPlayer == false then break ?script:
LUA:
local config = {
toKnow = 123456,
storage = 789456,
pos = {x = 160, y = 54, z = 7}, -- para onde o jogador será teleportado caso o tempo tenha acabado.
}
local count = 21
function onKill(cid, target, lastHit)
for i= 0, count-1 do
if getPlayerStorageValue(cid, config.toKnow+i) == 1 then
if getPlayerStorageValue(cid, config.storage+i) < os.time () then
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
doRemoveCreature(cid)
end
end
end
return true
end
local count2 = 21
function onLogin(cid)
for i= 0, count2-1 do
if getPlayerStorageValue(cid, config.toKnow+i) == 1 then
if getPlayerStorageValue(cid, config.storage+i) < os.time () then
doTeleportThing(cid, config.pos)
setPlayerStorageValue(cid, config.toKnow+i, 0)
end
end
end
return true
end
console error
Code:
[18:20:33.867] [Error - CreatureScript Interface]
[18:20:33.868] data/creaturescripts/scripts/caves/caveexclusiva20.lua:onKill
[18:20:33.872] Description:
[18:20:33.904] (LuaInterface::luaGetCreatureStorage) Creature not found