team.GetPlayers help

Hey guys, trying to set a limit for a team on my WIP gamemode. But when I do this


team.GetPlayers( 0 ) =< 5

it causes this error


[ERROR] gamemodes/jijo/gamemode/shared.lua:8: unexpected symbol near '='
  1. unknown - gamemodes/jijo/gamemode/shared.lua:0

[ERROR] gamemodes/jijo/gamemode/shared.lua:8: unexpected symbol near '<'
  1. unknown - gamemodes/jijo/gamemode/shared.lua:0




Any help would be appreciated :slight_smile:

I believe it should be <= for it to work, or that may just be the sleep deprivation talking

Thanks for replying!

Didn’t seem to work, however the error isn’t separate anymore. I guess that’s a change

Wait I didn’t even pay attention to the thread properly.

team.GetPlayers only returns the amount of players on a team. You can’t use an arithmetic just straight up like that

Yeah I thought that wouldn’t work xD. Anyways, what should I use?

Probably something like

[lua]
hook.Add(“OnTeamChange”, “MaxLimit”, function(ply, team) – I have no idea what the hook is, I don’t mess with teams, and I don’t know what needs to be defined. oops
if team.GetPlayers() >= 5 then – something like that
–deny team change
else
–allow team change
end
end
[/lua]

Ahhh I see. Thanks a lot man. You the real MVP :happy: