Hi! When no players is joining zombie event the event will spawn zombies untill it got no place to spawn. How to do like an event "addEvent(stopevent, 600*1000)"? So all zombies will be delted and no more zombies created.
This is the autostarter:
I tried to do it like this:
But I got this error when the event is started.
The error:
Thanks!
This is the autostarter:
Code:
function onTime(interval, lastExecution)
local players_on_arena_count = #getZombiesEventPlayers()
local function start()
if(players_on_arena_count >= 0) then
addZombiesEventBlockEnterPosition()
doSetStorage(ZE_STATUS, 2)
doBroadcastMessage("Zombie Event has started")
else
addZombiesEventBlockEnterPosition()
end
return true
end
setZombiesEventPlayersLimit(100)
doBroadcastMessage("Zombie Event is starting in 1 minutes. Enter the teleport in Thais temple to join!")
removeZombiesEventBlockEnterPosition()
addEvent(start,60*1000)
doSetStorage(ZE_STATUS, 1)
return true
end
I tried to do it like this:
Code:
function onTime(interval, lastExecution)
local players_on_arena_count = #getZombiesEventPlayers()
local function start()
if(players_on_arena_count >= 0) then
addZombiesEventBlockEnterPosition()
doSetStorage(ZE_STATUS, 2)
doBroadcastMessage("Zombie Event has started")
else
addZombiesEventBlockEnterPosition()
end
return true
end
setZombiesEventPlayersLimit(100)
doBroadcastMessage("Zombie Event is starting in 1 minutes. Enter the teleport in Thais temple to join!")
removeZombiesEventBlockEnterPosition()
addEvent(start,60*1000)
addEvent(stopeventzombie,600*1000)
doSetStorage(ZE_STATUS, 1)
return true
end
local function stopeventzombie()
if(players_on_arena_count >= 0) then
doSetStorage(ZE_STATUS, 0)
doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS)
doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0)
doSetStorage(ZE_ZOMBIES_SPAWNED, 0)
local width = (math.max(ZE_spawnFromPosition.x, ZE_spawnToPosition.x) - math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)) / 2 + 1
local height = (math.max(ZE_spawnFromPosition.y, ZE_spawnToPosition.y) - math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)) / 2 + 1
local centerPos = {x=math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)+width,y=math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)+height,z=ZE_spawnFromPosition.z}
for z = math.min(ZE_spawnFromPosition.z, ZE_spawnToPosition.z), math.max(ZE_spawnFromPosition.z, ZE_spawnToPosition.z) do
centerPos.z = z
for i, uid in pairs(getSpectators(centerPos, width, height, false)) do
if(isMonster(uid)) then
doRemoveCreature(uid)
end
end
end
end
end
But I got this error when the event is started.
The error:
[17:36:45.558] [Error - GlobalEvent Interface]
[17:36:45.558] data/globalevents/scripts/zombie/autostart.luanTime
[17:36:45.558] Description:
[17:36:45.558] (luaAddEvent) Callback parameter should be a function
Thanks!
