0 then local fail = {} for x=x[1], x[2] do for y=y[1], y[2] do local monster = getThingFromPos({x=x,y=y,z=z1,stackpos=255}).uid if isMonster(monster) then doRemoveCreature(monster) table.insert(fail, 1) end end end if #fail > 0 then doPlayerSendTextMessage(cid, 17, "You failed to clear the arena in the given time.") setPlayerStorageValue(cid, storage, -1) setGlobalStorageValue(global, 0) doTeleportThing(cid, exit) elseif #fail == 0 then doPlayerSendTextMessage(cid, 17, "Congratulations on surviving!\nGrab your reward!") doTeleportThing(cid, rewardroom) setGlobalStorageValue(global, 0) setPlayerStorageValue(cid, storage, -1) end end end local function spawn(cid, s) if getGlobalStorageValue(global) > 0 then if s <= spawnmax then local monster = monsters[getPlayerStorageValue(cid, storage)] for i = 1, s do doSummonCreature(monster, center) end if s == spawnmax then doPlayerSendTextMessage(cid, 17, "This is the last wave!\nStand firm "..getPlayerName(cid).." !") elseif s < spawnmax then doPlayerSendTextMessage(cid, 17, "The next wave with "..(s+s).." monsters will spawn in "..spawntime.." minutes.") end addEvent(spawn, spawntime*1000, cid, s+s) else addEvent(succes, 5000, cid) end end end function onStepIn(cid, item, fromPosition, toPosition) if getPlayerStorageValue(cid, storage) > 0 then doPlayerSendTextMessage(cid, 34, "You have entered the arena.\nYour chosen level is: "..getPlayerStorageValue(cid, storage).." out of 6.\nGood luck!") doTeleportThing(cid, center) addEvent(spawn, spawntime*1000, cid, spawnrate) else doPlayerSendCancel(cid, "You cannot enter this portal.") doTeleportThing(cid, toPosition) end end ]]> 0 then setGlobalStorageValue(global, 0) for x=x[1], x[2] do for y=y[1], y[2] do local id = getThingFromPos({x=x,y=y,z=z1,stackpos=255}).uid if isMonster(id) then doRemoveCreature(monster) end end end end end return true end ]]>