getTeamColor | Multi Theft Auto: Wiki Skip to content

getTeamColor

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function retrieves the color of a team.

Syntax

getTeamColor ( )

Code Examples

server

This example defines a console command that outputs the player's team name and colors if he is on a team.

function teamInfo ( source )
local r, g, b
local playerTeam = getPlayerTeam( source )
-- Make a string to print out the player's team information
local text = getPlayerName ( source )
if ( playerTeam ) then -- If the player is on a team (team is not false)
-- Add the team name to the string
text = text .. " is on " .. getTeamName ( playerTeam )
-- Get the red, green, and blue values of the team's color
r, g, b = getTeamColor ( playerTeam )
-- Convert the colors to strings and add them to the string
text = text .. " with team colors: " .. tostring(r) .. ", " .. tostring(g) .. ", " .. tostring(b)
else -- if he's not on a team
text = text .. " is not on a team."
end
-- Print the string with the player's team information
outputChatBox ( text )
end
-- Add console command to print out your team information
addCommandHandler ( "teamInfo", teamInfo )