function getZombiesEventPlayers()
local players = {}
for _, zid in pairs(getPlayersOnline()) do
if getPlayerStorageValue(zid, 1288) == 1 then
table.insert(players, zid)
end
end
return players
end
local players = getZombiesEventPlayers()
function onSay(cid, words, param, channel)
local t = split(param, ',')
local stones = {
{x = 1054, y = 1183, z = 7},
{x = 1055, y = 1183, z = 7},
{x = 1056, y = 1183, z = 7},
{x = 1057, y = 1183, z = 7}
}
local pumkins = {
{x = 1053, y = 1172, z = 7},
{x = 1062, y = 1174, z = 7},
{x = 1057, y = 1167, z = 7},
{x = 1044, y = 1173, z = 7}
}
---------------------------------------------------------------------------------------------------------------------------
if (t[1] == 'start') then
local storage = getGlobalStorageValue(1285)
if storage == 1 then
for _, bid in pairs(getPlayersOnline()) do
if getCreatureStorage(bid, 1288) == 1 and getPlayerAccess(bid) < 3 then
local newpos = {x = 1055, y = 1182, z = 7}
doTeleportThing(bid, newpos)
end
end
for i = 1, 4 do
doSendMagicEffect(stones[i], 35)
doRemoveItem(getTileItemById({x = 1054, y = 1183, z = 7}, 1285).uid)
doRemoveItem(getTileItemById({x = 1055, y = 1183, z = 7}, 1285).uid)
doRemoveItem(getTileItemById({x = 1056, y = 1183, z = 7}, 1285).uid)
doRemoveItem(getTileItemById({x = 1057, y = 1183, z = 7}, 1285).uid)
doSendAnimatedText(stones[i], "RUN", 240)
end
doRemoveItem(getTileItemById({x = 991, y = 1000, z = 7}, 1387).uid)
setGlobalStorageValue(1285, 2)
doBroadcastMessage("".. getCreatureName(cid) .." has started zombie event and removed teleport in temple", MESSAGE_EVENT_ADVANCE)
for f = 1, 6 do
doSummonCreature("Psycho Pumpkin", pumkins[f])
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Open zombie teleport first with /zombie waiting.")
end
---------------------------------------------------------------------------------------------------------------------
elseif (t[1] == 'end') then
local storage = getGlobalStorageValue(1285)
if storage ~= 0 then
function CleanPlayers()
for x = 1052, 1059 do
for y = 1183, 1187 do
local newpos = {x = 994, y = 993, z = 7}
local a = getTopCreature({x=x, y=y, z=7}).uid
if a ~= 0 and isPlayer(a) then
doTeleportThing(a, newpos)
doSendMagicEffect(newpos, CONST_ME_POFF)
end
end
end
end
for _, aid in pairs(getPlayersOnline()) do
if getCreatureStorage(aid, 1288) == 1 and getPlayerAccess(aid) < 3 then
doCreatureSetStorage(aid, 1288, 0)
end
end
CleanPlayers()
doRemoveItem(getTileItemById({x = 991, y = 1000, z = 7}, 1387).uid)
setGlobalStorageValue(1285, 0)
function CleanArena()
for x = 1042, 1070 do
for y = 1165, 1186 do
local newpos = {x = 994, y = 993, z = 7}
local a = getTopCreature({x=x, y=y, z=7}).uid
if a ~= 0 and isMonster(a) then
doRemoveCreature(a)
elseif a ~= 0 and isPlayer(a) then
doTeleportThing(a, newpos)
doSendMagicEffect(newpos, CONST_ME_POFF)
end
a = getThingfromPos({x=x, y=y, z=7, stackpos=254}).uid
if a ~= 0 then
doRemoveItem(a)
end
end
end
return true
end
CleanArena()
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Zombie event is not open atm.")
end
--------------------------------------------------------------------------------------------------------------------------------------
elseif (t[1] == 'waiting') then
function getZombiesEventPlayers()
local players = {}
for _, zid in pairs(getPlayersOnline()) do
if getCreatureStorage(zid, 1288) == 1 and getPlayerAccess(zid) < 3 then
table.insert(players, zid)
end
end
return players
end
local storage = getGlobalStorageValue(1285)
local tp = doCreateTeleport(1387, {x = 1055, y = 1185, z = 7}, {x = 991, y = 1000, z = 7})
if storage ~= 1 then
setGlobalStorageValue(1285, 1)
doItemSetAttribute(tp, "aid", 1285)
doBroadcastMessage("".. getCreatureName(cid) .." has started zombie event to enter go temple teleport on south", MESSAGE_EVENT_ADVANCE)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Zombie is already waiting for players.")
end
elseif (t[1] == 'check') then
local players = getZombiesEventPlayers()
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[".. #players .."] players with zombie storage")
elseif (t[1] == 'kick') then
local kid = getPlayerByNameWildcard(t[2])
if(not kid) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have to enter player name after kick.")
else
if getCreatureStorage(kid, 1288) == 1 then
doBroadcastMessage("" .. getCreatureName(cid) .. " has kicked [" .. getCreatureName(kid) .. "] from zombie event!", MESSAGE_STATUS_CONSOLE_RED)
doCreatureSetStorage(kid, 1288, 0)
doTeleportThing(kid, {x = 994, y = 993, z = 7})
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[".. getCreatureName(kid) .."] not in zombie event.")
end
end
end
return true
end