Jump to content

Help with teams


manve1

Recommended Posts

Posted

How could i set maximum player amount in a team?

Like for example, i created a team, and i only want that 3people would be allowed in that team, no more?

thank you for the help.

Posted
addEventHandler( 'onClientGUIClick', buttonJuggernaut, 
    function() 
        triggerServerEvent('giveJuggernautTeam', localPlayer) 
        local theTeamJuggernaut = getTeamFromName( 'Juggernaut' ) 
        if ( countPlayersInTeam( theTeamJuggernaut ) ) then 
            guiSetVisible( windowTeams, false ) 
        else 
            tooMuchJuggernauts = guiCreateLabel( 0.2, 0.3, 0.4, 0.1, "There are to many Juggernauts already", true ) 
            guiSetFont( tooMuchJuggernauts, "sa-header" ) 
        end 
    end, false 
) 
     

addEvent('giveJuggernautTeam', true) 
addEventHandler('giveJuggernautTeam', getRootElement(), 
    function() 
        setPlayerTeam(source, getTeamFromName('Juggernaut')) 
    end 
) 

something i tried to do, but didn't work out, top is client, bottom is server sided scripts, i know they are not one of the working ones, but everything there like gui, buttons exist :)

Posted
if ( countPlayersInTeam( theTeamJuggernaut ) ) then 

You are not comparing it with anything.

if ( countPlayersInTeam( theTeamJuggernaut ) < 3 ) then 

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...