• team.GetPlayers help
    6 replies, posted
Hey guys, trying to set a limit for a team on my WIP gamemode. But when I do this [CODE]team.GetPlayers( 0 ) =< 5[/CODE] it causes this error [CODE][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 [/CODE] Any help would be appreciated :)
I believe it should be <= for it to work, or that may just be the sleep deprivation talking
[QUOTE=Chimpanzee;48378152]I believe it should be <= for it to work, or that may just be the sleep deprivation talking[/QUOTE] 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
[QUOTE=Chimpanzee;48378236]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[/QUOTE] 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:
Sorry, you need to Log In to post a reply to this thread.