I'm making a fretta gamemode and I want one team to be limited to three players whereas the other has no limit. What object would I use to check the number of players on a team?
[QUOTE=Overv;22834577]Nice searching... [b][url=http://wiki.garrysmod.com/?title=Team.NumPlayers]Team.NumPlayers [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b][B][/B][/QUOTE]
I actually did look, but because I'm an idiot and expected it to be in Gamemode Hooks or Fretta Hooks, I didn't see it.
Thanks.
EDIT: Would this be correct?
[code]function GM:PlayerJoinTeam( ply, teamid )
if ply:Team() == TEAM_SPECTATOR and teamid == TEAM_HUMAN and team.NumPlayers(TEAM_HUMAN) <= 1
return true
if ply:Team() == TEAM_COMBINE and teamid == TEAM_HUMAN and team.NumPlayers(TEAM_HUMAN) <= 1
return true
if ply:Team() == TEAM_SPECTATOR and teamid == TEAM_HUMAN and team.NumPlayers(TEAM_HUMAN) > 2
return false
print("There are already enough rebels.")
if ply:Team() == TEAM_COMBINE and teamid == TEAM_HUMAN and team.NumPlayers(TEAM_HUMAN) > 2
return false
print("There are already enough rebels.")
end
end[/code]
On a related note, in Fretta, do a team's total deaths reset after each round? The way of implementing the win condition for one team that I thought of kinda requires that, because it compares the team's total deaths to the number of players on the team.
No, because you forgot to add "then" at the end.
Yes, you need to place 4 "then" in the script.
You need to place them after the numbers:
[code]if loolololol <= 1 then[/code]
And an end after you're done evaluating
Oh right, yea.
Put an "end" after you "return true" and after you're done printing stuff to the player.
Sorry, you need to Log In to post a reply to this thread.