Jump to content

[QUESTION]Auto Balance Teams


Twisted

Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...