local area = {
frompos = {x=347, y=556, z=8},
topos = {x=472, y=664, z=1}
}
local reward, count = 2160, 5
tppos = {x=156, y=654, z=7, stackpos=1}
local function check1(cid)
local players = 0
if isPlayer(cid) then
for _,pid in ipairs(getPlayersOnline()) do
if pid ~= cid and isInRange(getCreaturePosition(pid), area.frompos, area.topos) then
players = players + 1
end
end
if players < 1 then
doPlayerAddItem(cid,reward,count)
setGlobalStorageValue(74999, -1)
setPlayerStorageValue(cid, 74910, -1)
setPlayerStorageValue(cid, 74911, -1)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doRemoveCondition(cid, CONDITION_INFIGHT)
broadcastMessage(getCreatureName(cid) .. " won!", MESSAGE_EVENT_ADVANCE)
rtp = getThingfromPos(tppos)
doRemoveItem(rtp.uid,1)
else
doPlayerSendTextMessage(0, cid, 22, "You aren\'t the only survivor. Only one can win this event!")
end
end
return true
end
function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) then
event_check = addEvent(check1, 10 * 1000,cid)
doSendMagicEffect(getPlayerPosition(cid), 34)
end
return true
end
function onStepOut(cid, item, position, fromPosition)
if isPlayer(cid) and event_check then
stopEvent(event_check)
end
return true
end