Twisted Posted February 4, 2013 Share Posted February 4, 2013 I haven't attempted this yet but how could I auto balance teams if one team has more players than others? Post the required functions I may need Thanks --Twisted Link to comment
jef Posted February 4, 2013 Share Posted February 4, 2013 You should look at: https://wiki.multitheftauto.com/wiki/CountPlayersInTeam Example from the page: function balanceTeams ( thePlayer ) --get the team pointers from their names local groveTeam = getTeamFromName ( "grove" ) local ballasTeam = getTeamFromName ( "ballas" ) --count the number of players in each team, and store them local groveCount = countPlayersInTeam ( groveTeam ) local ballasCount = countPlayersInTeam ( ballasTeam ) if groveCount == ballasCount then --if the teams are equal setPlayerTeam ( thePlayer , groveTeam ) --place the player in grove elseif groveCount > ballasCount then --if there are more in grove setPlayerTeam ( thePlayer , ballasTeam ) --place him in ballas elseif groveCount < ballasCount then --if there are more in ballas setPlayerTeam ( thePlayer , groveTeam ) --place him in grove. end end Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now