events1,events2= {},{}
local config = {tempo = 15,storage = 20000 }
function onStepIn(cid, item, frompos, topos)
if isPlayer(cid) and getPlayerStorageValue(cid, config.storage) <= 0 then
doPlayerSendTextMessage(cid, 22, "[Trainer]: Movimente-se a cada " .. config.tempo .. " minutos, caso contrário, seu char será levado ao templo.")
setPlayerStorageValue(cid, config.storage, 1)
events1[getPlayerGUID(cid)] = addEvent(setPlayerStorageValue, config.tempo*60*1000-1000, cid, config.storage, -1)
events2[getPlayerGUID(cid)] = addEvent(doTeleportThing, config.tempo*60*1000-500, cid, getTownTemplePosition(getPlayerTown(cid)))
end
return true
end
function onStepOut(cid, item, frompos, topos)
if isPlayer(cid) and getPlayerStorageValue(cid, config.storage) >= 1 then
setPlayerStorageValue(cid, config.storage, -1)
doPlayerSendTextMessage(cid, 23, "System kick off!")
stopEvent(events1[getPlayerGUID(cid)])
stopEvent(events2[getPlayerGUID(cid)])
end
return true
end