local area = {
frompos = {x= 347, y = 556 , z = 8},
topos = {x= 472, y = 664 , z = 0}
}
local reward, count = 2160, 5
tppos = {x=156, y=654, z=7, stackpos=1}
local players = 0
local function check1(cid)
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)
db.executeQuery("UPDATE `player_storage` SET `value` = -1 WHERE `key` = 74910")
db.executeQuery("UPDATE `player_storage` SET `value` = -1 WHERE `key` = 74911")
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