Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function GM:CanStartRound(iNum)
- for _, v in pairs(team.GetPlayers(TEAM_GAMEMASTER)) do
- v:SetTeam(TEAM_RUNNER)
- end
- if team.NumPlayers(TEAM_RUNNER) > 1 then
- local players = team.GetPlayers(TEAM_RUNNER)
- local maxvar = 0
- local maxvarplayers = {}
- for i,ply in pairs(players) do
- if (ply:GetNWInt("NoSRRounds") > maxvar) then
- maxvar = ply:GetNWInt("NoSRRounds")
- end
- end
- for i,ply in pairs(players) do
- if (ply:GetNWInt("NoSRRounds") == maxvar) then
- table.insert(maxvarplayers, ply)
- end
- end
- local the_chosen_one = table.Random(maxvarplayers) //Select random gamemaster
- the_chosen_one:SetTeam(TEAM_GAMEMASTER)
- the_chosen_one:SetNWInt("NoSRRounds", 0)
- return true
- else
- return false
- end
- end
- hook.Add( "OnRoundStart", "GM_OnRoundStart", GM_OnRoundStart )
- function GM_OnRoundStart()
- pls = player.GetAll
- for i, ply in pairs(pls) do
- if (ply:Team() == TEAM_RUNNER) then
- ply:SetNWInt("NoSRRounds", ply:GetNWInt("NoSRRounds") + 1)
- elseif (ply:Team() == TEAM_GAMEMASTER) then
- ply:SetNWInt("NoSRRounds", 0)
- end
- end
- end
Add Comment
Please, Sign In to add comment