local t = {
a = 11145,
g = 11146,
l = 11147,
u = 11148,
h = 11149,
wv = 11150,
c = 0,
q = "Rush Event has been started! Enjoy and have fun!",
f = 15447,
f_1 = 15448,
f_2 = 15449,
d_1 = {x = 32061, y = 32317, z = 7}, -- red temple
d_2 = {x = 32061, y = 32294, z = 7}, -- blue temple
x = "Event won't start bacause too few people were willing to participate",
w = {x = 32135, y = 32328, z = 8},
lvl = 150,
v = 2,
mn = 2,
m = 40,
o = "Event was completed, RED TEAM has won Rush Event!",
y = "Event was completed, BLUE TEAM has won Rush Event!",
i_1 = 2160,
i_2 = 10,
t = 1,
r = 1,
timetoclose = 420,
teleportActionId = 11112, -- Action id of the teleport needed for the movement script
teleportPosition = {x = 32346, y = 32224, z = 7, stackpos = 1}, -- Where the teleport will be created
teleportToPosition = {x = 32135, y = 32328, z = 8}, -- Where the teleport will take you
teleportId = 1387, -- Id of the teleport
nie = {x=32349, y=32222, z=6}
}
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if getGlobalStorageValue(t.wv) ~= 1 then
[COLOR="#FF0000"] for _, pid in pairs(getPlayersOnline()) do
if getPlayerStorageValue(pid, t.a) == 1 then
if getPlayerIp(cid) == getPlayerIp(pid) then[/COLOR]
if getPlayerLevel(cid) >= t.lvl then
doTeleportThing(cid,{x=32136, y=32265, z=7},false)
if getPlayerStorageValue(cid, t.f) == -1 then
if getGlobalStorageValue(t.c) < t.m then
setGlobalStorageValue(t.c, getGlobalStorageValue(t.c)+1)
setPlayerStorageValue(cid, t.a, 1)
if getGlobalStorageValue(t.c) == t.m then
doPlayerSendCancel(cid, "Event is full [" .. getGlobalStorageValue(t.c) .. " players]!")
else
doTeleportThing(cid,t.w,false)
doBroadcastMessage("" .. getPlayerName(cid) .. " has joined to Rush Event! Actually we have: " .. getGlobalStorageValue(t.c) .. " players!", MESSAGE_EVENT_DEFAULT)
end
setPlayerStorageValue(cid, t.f, 1)
setPlayerStorageValue(cid, t.h, -1)
doTeleportThing(cid, t.w)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
setPlayerStorageValue(cid, t.g, getGlobalStorageValue(t.g))
setGlobalStorageValue(t.g, tonumber(getGlobalStorageValue(t.g))+1)
else
doPlayerSendCancel(cid, "Event is full [" .. getGlobalStorageValue(t.c) .. " players]!")
doTeleportThing(cid, fromPosition, true)
return true
end
else
doPlayerSendCancel(cid, "You are already registered in this event.")
doTeleportThing(cid, fromPosition, true)
return true
end
else
doTeleportThing(cid, fromPosition, true)
doPlayerSendTextMessage(cid,MESSAGE_TYPES["orange"],"Only players of level ".. t.lvl.. "+ can join this event.")
return true
end
else
doPlayerSendCancel(cid, "Sorry, MC's not allowed here.")
doTeleportThing(cid, fromPosition, true)
return true
end
end
end
else
doPlayerSendCancel(cid, "At the moment there are no records for this event.")
doTeleportThing(cid, fromPosition, true)
return true
end
return true
end