Testei aqui e não deu debug.
local spawnboss = {x=66,y=490,z=8}
local spawnplayer = {x=68,y=483,z=8}
local NWcorner = {x=60,y=481,z=8, stackpos = 255}
local SEcorner = {x=76,y=494,z=8, stackpos = 255}
local deny = {x=311, y=403, z=12}
local storage = {65030,2} -- storage required to enter
local keyafter = -1 -- key that will be set to storage above when player enters arena
local boss = "demodras"
local fighttime = 10 * 60 * 1000 -- ten minutes
local delayglobal = 95001 -- enterance counter storage returning remaining time of current user
function kickEvent1(cid, item, position, fromPosition)
if getCreaturesInQuestArea(TYPE_PLAYER, NWcorner, SEcorner, GET_COUNT) > 0 then
doTeleportThing(cid, deny)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doCreatureSay(cid, "Time up. Your chance is over.", TALKTYPE_ORANGE_2, false, nil, getCreaturePosition(cid))
end
end
function onStepIn(cid, item, pos)
if getPlayerStorageValue (cid, storage[1]) == storage[2] then
if getCreaturesInQuestArea(TYPE_PLAYER, NWcorner, SEcorner, GET_COUNT) > 0 then
doTeleportThing(cid,deny)
doCreatureSay(cid, "Someone is still in this room. Please wait for your turn(max " .. getGlobalStorageValue(delayglobal)-os.time() .. " seconds left).", TALKTYPE_ORANGE_2, false, nil, pos)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREAREA)
else
doTeleportThing(cid,spawnplayer)
doSendMagicEffect(getCreaturePosition(cid),CONST_ME_FIREAREA)
doSendMagicEffect(getCreaturePosition(cid),CONST_ME_TELEPORT)
doCreatureSay(cid, "You have ten minutes to slain your enemy, otherwise you will be kicked out.", TALKTYPE_ORANGE_2, false, nil, pos)
setGlobalStorageValue(delayglobal, os.time() + (fighttime / 1000))
setPlayerStorageValue(cid,storage[1],keyafter)
doSummonCreature(boss, spawnboss)
demodras = addEvent(kickEvent1, fighttime, cid)
end
else
doTeleportThing(cid,deny)
doCreatureSay(cid, "You are not allowed to enter here!", TALKTYPE_ORANGE_2, false, nil, pos)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREAREA)
end
doSendMagicEffect(getThingfromPos(item.uid), CONST_ME_PURPLEENERGY)
return true
end