Well, what a mess...
Note that this was written off memory, so it may contain errors.
local World = cRoot:Get():GetWorld("world") local GameStartSecond = 60 -- Number of seconds till the game start local GameStartTick = GameStartSecond * 20 -- Set up timed messages until the game start: local AnnouncedSecods = {60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2} -- When to broadcast for idx, Second in ipairs(AnnouncedSeconds) do World:ScheduleTask( function (a_World) a_World:BroadcastChat("Time till game start: " .. Second .. " seconds") end, GameStartTick - Second * 20 ) end -- One last message to schedule, due to message text change: World:ScheduleTask( function (a_World) a_World:BroadcastChat("Time till game start: 1 second"); end, GameStartTick - 20 -- 1 second before game start ) -- Schedule the Voting end: World:ScheduleTask( function (a_World) -- a_World:BroadcastChat("The Voting has ended!"); a_World:ForEachPlayer( function(Player) Player:GetInventory():Clear(); Player:GetInventory():SetHotbarSlot(8, cItem(E_ITEM_FIRE_CHARGE)); end ) end, GameStartTick - 15 * 20 -- 15 seconds before game start ) -- Schedule the game start: World:ScheduleTask( function (a_World) -- TODO: Start the game end, GameStartTick )
Note that this was written off memory, so it may contain errors.