07.10.2010, 17:19
As stated above, colors are integers, that are usually represented in hex form.
Solving your problem depends on how you are setting the color variables, be it from a string retrieved from a command, or a #define, or whatever.
you can convert a hex string to integer using sscanf2
https://sampforum.blast.hk/showthread.php?tid=120356
I'm not sure if sscanf2 checks for the correct samp hex color format ( I presume it doesn't ) so if you are retrieving the colors from a command, I would check the format with something like this.
[edit] oops I just saw you already knew this, oh well good luck.
Solving your problem depends on how you are setting the color variables, be it from a string retrieved from a command, or a #define, or whatever.
you can convert a hex string to integer using sscanf2
https://sampforum.blast.hk/showthread.php?tid=120356
pawn Код:
CMD:testcolor(playerid,params[])
{
new color;
if(!sscanf(params,"h",color))
{
....
}
}
pawn Код:
if(strlen(params) == 10 && !strcmp(tmp,"0x",true,2)) //success