SetTeamColor: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(OOP syntax added)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server function}}
{{Server function}}
This function is for setting the color of a specified team.
This function is for setting the color of a specified team. This color is shown, for example, in the team players' nametags.


==Syntax==
==Syntax==
Line 7: Line 7:
bool setTeamColor ( team theTeam, int colorR, int colorG, int colorB )
bool setTeamColor ( team theTeam, int colorR, int colorG, int colorB )
</syntaxhighlight>
</syntaxhighlight>
 
{{OOP||[[team]]:setColor||}}
===Required Arguments===
===Required Arguments===
*'''theTeam:''' The team you want to change the color of.
*'''theTeam:''' The [[team]] you want to change the color of.
*'''colorR:''' An integer representing the Red color value.
*'''colorR:''' An integer representing the red color value, from 0 to 255.
*'''colorG:''' An integer representing the Green color value.
*'''colorG:''' An integer representing the green color value, from 0 to 255.
*'''colorB:''' An integer representing the Blue color value.
*'''colorB:''' An integer representing the blue color value, from 0 to 255.


===Returns===
===Returns===
Returns 'true' if the team is valid and the color is different, otherwise 'false'.
Returns ''true'' if the team is valid and the color is different, otherwise ''false''.


==Example==
==Example==
Line 21: Line 21:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
team = createTeam ( "RedTeam", 255, 0, 0 ) -- create the team
team = createTeam ( "RedTeam", 255, 0, 0 ) -- create the team
if ( team ) then                          -- if the team was created
if ( team ) then                          -- if the team was created (a team with that name didn't already exist)
     setTeamName ( team, "BlueTeam" )      -- change the name
     setTeamName ( team, "BlueTeam" )      -- change the name
     setTeamColor ( team, 0, 0, 255 )      -- change the color to suit its new name
     setTeamColor ( team, 0, 0, 255 )      -- change the color to suit its new name

Latest revision as of 06:53, 12 July 2014

This function is for setting the color of a specified team. This color is shown, for example, in the team players' nametags.

Syntax

bool setTeamColor ( team theTeam, int colorR, int colorG, int colorB )

OOP Syntax Help! I don't understand this!

Method: team:setColor(...)


Required Arguments

  • theTeam: The team you want to change the color of.
  • colorR: An integer representing the red color value, from 0 to 255.
  • colorG: An integer representing the green color value, from 0 to 255.
  • colorB: An integer representing the blue color value, from 0 to 255.

Returns

Returns true if the team is valid and the color is different, otherwise false.

Example

This example creates a new team then changes its name and color.

team = createTeam ( "RedTeam", 255, 0, 0 ) -- create the team
if ( team ) then                           -- if the team was created (a team with that name didn't already exist)
    setTeamName ( team, "BlueTeam" )       -- change the name
    setTeamColor ( team, 0, 0, 255 )       -- change the color to suit its new name
end

See Also

Shared