01-18-2014, 12:07 AM
local COUNT_TO = 60; for I=COUNT_TO, 0, -1 do -- Countdown --AddLobbySchedule(LobbyCountDown, {I}, (COUNT_TO - I) * 20); cRoot:Get():GetWorld("world"):ScheduleTask(LobbyCountDown(I), (COUNT_TO - I) * 20); end
function LobbyCountDown(Time) cRoot:Get():ForEachPlayer(function(Player) Player:DeltaExperience(-(cPlayer:XpForLevel(Player:GetXpLevel()) - cPlayer:XpForLevel(Player:GetXpLevel() - 1))); end) if (Time == 60) then cRoot:Get():ForEachPlayer(function(Player) Player:DeltaExperience(-Player:GetXpLevel()); Player:DeltaExperience(cPlayer:XpForLevel(60)); end) cRoot:Get():BroadcastChat(Time); elseif (Time == 50) then cRoot:Get():BroadcastChat(Time); elseif (Time == 40) then cRoot:Get():BroadcastChat(Time); elseif (Time == 30) then cRoot:Get():BroadcastChat(Time); elseif (Time == 20) then cRoot:Get():BroadcastChat(Time); elseif (Time == 15) then cRoot:Get():ForEachPlayer(function(Player) Player:GetInventory():Clear(); Player:GetInventory():SetHotbarSlot(8, cItem(E_ITEM_FIRE_CHARGE)); end) --cRoot:Get():BroadcastChat("The Voting has ended!"); --cRoot:Get():BroadcastChat("Map: " .. map); elseif (Time == 10) then cRoot:Get():BroadcastChat(Time); elseif (Time == 9) then cRoot:Get():BroadcastChat(Time); elseif (Time == 8) then cRoot:Get():BroadcastChat(Time); elseif (Time == 7) then cRoot:Get():BroadcastChat(Time); elseif (Time == 6) then cRoot:Get():BroadcastChat(Time); elseif (Time == 5) then cRoot:Get():BroadcastChat(Time); elseif (Time == 4) then cRoot:Get():BroadcastChat(Time); elseif (Time == 3) then cRoot:Get():BroadcastChat(Time); elseif (Time == 2) then cRoot:Get():BroadcastChat(Time); elseif (Time == 1) then cRoot:Get():BroadcastChat(Time); elseif (Time == 0) then cRoot:Get():BroadcastChat(Time); local onlineplayers = cRoot:Get():GetServer():GetNumPlayers(); if (onlineplayers >= 0) then gamerunning = "yes"; cRoot:Get():ForEachPlayer(function(Player) --Player:DeltaExperience(-Player:GetXpLevel()); Player:GetInventory():Clear(); Player:SetGameMode(0); --Player:MoveToWorld(map); --Teleport player to right coords... --Player:TeleportToCoords(48, 4, 283); local COUNT_TO = 30; for I=COUNT_TO, 0, -1 do -- Countdown --AddStartSchedule(StartCountDown, {I}, (COUNT_TO - I) * 20); cRoot:Get():GetWorld("world").ScheduleTask(StartCountDown(I), (COUNT_TO - I) * 20); end end) else cRoot:Get():BroadcastChat("Game don\'t start. Too few players!"); end end end