CreateTeam: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
team createTeam ( string teamName )
team createTeam ( string teamName, [int colorR = 255, int colorB = 255, int colorG = 255 ] )
</syntaxhighlight>
</syntaxhighlight>


===Required Arguments===
===Required Arguments===
*'''teamName:''' A string representing the teams name.
*'''teamName:''' A string representing the teams name.
*'''colorR:''' An integer representing the Red color value.
*'''colorG:''' An integer representing the Green color value.
*'''colorB:''' An integer representing the Blue color value.


===Returns===
===Returns===

Revision as of 21:14, 14 September 2006

This function is for creating a new team, which can be used to group players.

Syntax

team createTeam ( string teamName, [int colorR = 255, int colorB = 255, int colorG = 255 ] )

Required Arguments

  • teamName: A string representing the teams name.
  • colorR: An integer representing the Red color value.
  • colorG: An integer representing the Green color value.
  • colorB: An integer representing the Blue color value.

Returns

Returns a team object if it was successfully created, 'false' otherwise.

Example

This example creates a new team for a player, then adds him to it.

addCommandHandler ( "gimmeATeam", "gimmeATeam" )
function gimmeATeam ( source, key, teamName )
  team = createTeam ( teamName ) -- create a new team with the specified name
  if ( team ) then -- if it was successfully created
    addPlayerToTeam ( source, team ) -- add the player to the new team
  end
end

See Also