Player color is a string or integer?
#1

title
Reply
#2

It's hex, I guess. Not a string anyway.
Reply
#3

A HEX is actually a integer but if your supplying a HEX value as input it will be a string, you can use sscanf.

pawn Код:
new int;
sscanf(params, "h", color);
This stock will check if the value you entered is a valid HEX value remember that it only accepts HEX values in a 0x00000000 format it's designed specifically for colors only.

pawn Код:
// Is string a hexvalue
stock IsHexValue(hstring[])
{
    if(strlen(hstring) < 10) return 0;
    if(hstring[0] == 48 && hstring[1] == 120)
    {
        for(new i = 2; i < 10; i++)
        {
            if(hstring[i] == 48 || hstring[i] == 49 || hstring[i] == 50 || hstring[i] == 51 || hstring[i] == 52 ||
                hstring[i] == 53 || hstring[i] == 54 || hstring[i] == 55 || hstring[i] == 56 || hstring[i] == 57 ||
                hstring[i] == 65 || hstring[i] == 66 || hstring[i] == 67 || hstring[i] == 68 || hstring[i] == 69 ||
                hstring[i] == 70) continue;
            else return 0;
        }
    }
    else return 0;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)