E
Evil Puncker
Guest
Hi everyone, I have this code to check every SQM that have action ID 2130 every 60 seconds to see if player storage is still valid, it works very well, but once it teleport me, the line 7 is executed twice, why?
LUA:
local event = {}
local function checkSQM(cid)
local player = Player(cid)
if player:getStorageValue(1234) < os.time() then
event[cid] = nil
player:teleportTo(Position(326, 300, 7))
player:popupFYI("<msg>")
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
else
event[cid] = addEvent(checkSQM, 60 * 1000, cid)
end
event[cid] = nil
end
local moveevent = MoveEvent("example")
function moveevent.onStepIn(creature, item, position, fromPosition)
if creature:isPlayer() then
checkSQM(creature:getId())
end
end
moveevent:aid(2130)
moveevent:register()
