Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*---------------------------------------------------------
- RoundStart
- Code ran at the start of the round, mostly handles
- if the round can start, giving the players weapons
- and their spawn.
- ---------------------------------------------------------*/
- function RoundStart()
- if IsRound == false then -- Checks if it isn't a round so it won't start a round in middle of another.
- if #player.GetAll() >= GetConVar("jw_minplayers"):GetInt() then -- Checks if there are enough players to start the rounds.
- RoundStartTime
- print("debug RoundStart")
- RoundTime()
- IsRound = true -- Makes sure to only run this function once.
- end
- end
- end
- hook.Add("Think", "SecondPrint2", RoundStart)
- /*---------------------------------------------------------
- RoundEnd
- Handles the conditions of a round end and calls
- the end screen.
- ---------------------------------------------------------*/
- function RoundEnd()
- if #player.GetAll() < GetConVar("jw_minplayers"):GetInt() then return end -- Checks if there isn't enough players so it won't keep doing rounds when there aren't players.
- if IsRound == false then return end -- Makes sure this does not conflicts with the RoundStart
- if IsRound == true then -- Runs code after the round has started.
- if team.NumPlayers(1) == 0 and team.NumPlayers(2) == 0 then -- Check for stalemate
- print("Stalemate!")
- IsRound = false
- timer.Simple(2, RoundStart)
- elseif team.NumPlayers(1) >= 1 and team.NumPlayers(2) == 0 then -- Check for Guards winning.
- print("The guards stopped the rebellion!")
- IsRound = false
- timer.Simple(2, RoundStart)
- elseif team.NumPlayers(1) == 0 and team.NumPlayers(2) >= 1 then -- Check for Inmates winning.
- print("The Inmates have outrun the guards!")
- IsRound = false
- timer.Simple(2, RoundStart)
- elseif RoundEndTime >= CurTime() then -- Check for the round end because of time(makes it a stalemate.)
- print("Stalemate!")
- IsRound = false
- timer.Simple(2, RoundStart)
- end
- end
- end
- hook.Add("Think", "SecondPrint", RoundEnd)
- /*---------------------------------------------------------
- RoundTime
- Creates the timed part of the rounds.
- ---------------------------------------------------------*/
- function RoundTime()
- RoundStartTime = CurTime()
- RoundEndTime = RoundStartTime + GetConVar("jw_roundtime"):GetInt()
- end
Add Comment
Please, Sign In to add comment