xxxxxxxxxx
function RGBToHex(red, green, blue, alpha)
-- Make sure RGB values passed to this function are correct
if( ( red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255 ) or ( alpha and ( alpha < 0 or alpha > 255 ) ) ) then
return nil
end
-- Alpha check
if alpha then
return string.format("#%.2X%.2X%.2X%.2X", red, green, blue, alpha)
else
return string.format("#%.2X%.2X%.2X", red, green, blue)
end
end
xxxxxxxxxx
function myTeamColor(Player,Command) -- adding the function
playerTeam = getPlayerTeam(Player)
if playerTeam then
r,g,b = getTeamColor(playerTeam)
if r and g and b then
outputChatBox("your team color is : "..RGBToHex(r,g,b))
end
end
end
addCommandHandler("myteamcolor",myTeamColor) -- adding command handler