Hello,
My first question is regarding SetPlayerName, what kind of parameter is it awaiting at color? i tried to give string, and its giving meh the tag mismatch error, integer cant hold color code...
My second question is... is there a way to convert my hex color code into the rgb format? (or any format that allows you to use in SetPlayerColor color)
Posts: 1,208
Threads: 36
Joined: Apr 2015
PHP код:
CMD:color(playerid,params[]){
new color
sscanf(params,"x",color);
SetPlayerColor(playerid,((color << 8) | 0xFF));
return 1;
}
Posts: 1,208
Threads: 36
Joined: Apr 2015
PHP код:
new Color[15], vcolor;
format(Color, sizeof(Color), "%s",GetColor(playerid));
sscanf(Color,"x",vcolor);
if(!strcmp(Color, "0000", true))
{
SetPlayerColor(playerid,((vcolor << 8) | 0xFF));
}
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
Colors are integers. Just because the hexadecimal representation has letters in it doesn't mean it's a string.
Abyss, could you explain your library's function HexToRGB ?
Posts: 1,208
Threads: 36
Joined: Apr 2015
HexToRGB merges 3 values: red, green, blue (0 - 255 or 0x00 - 0xFF)
PHP код:
HexToRGB(&color,red,green,blue);
PHP код:
new color;
HexToRGB(color,255,0,0);
SetPlayerColor(playerid,RGBToRGBA(color,0xFF));
Okay, lemme explain... you might be able to help me better...
I have a gang system, we store gang colors in hex format in database, but then we want player color is same as gang color... and thus i need this function.
Like for example, how can i set a players color to green (hex: 2fa731)