function onTime(interval, lastExecution)
local minPlayers = 1
local maxPlayers = 2
local waitTime = 5
local playersOnline = getOnlinePlayers()
if playersOnline > maxPlayers then --How do I set this correctly?
-- If it's a staff member, just teleport inside and do not count as a participant
if player:getGroup():getAccess() then
player:teleportTo(ze_WaitingRoomStartPosition)
return false
end
-- If the state of the event is closed or started, stop them from join
if isInArray({ze_EVENT_CLOSED, ze_EVENT_STARTED}, getZombieEventState()) then
return false
end
-- If player got pz, forbid them to join
if player:isPzLocked() then
player:sendCancelMessage("You cannot join while your in a fight.")
return false
end
-- If there is max players joined, stop them from join
if getZombieEventJoinedCount() >= ze_maxPlayers then
player:sendCancelMessage("The event is already full.")
return false
end
-- Set the new variables and setup the event
setupZombieEvent(minPlayers, maxPlayers, waitTime)
end
return false
end