22.01.2015, 12:40
Your functions checks if there are small letters but you never convert them
pawn Код:
CMD:factioncolor(playerid, params[]) {
new
color = HexToInt(params)
;
if(color == 0) {
return SendClientMessage(playerid, -1, "USAGE: /factioncolor [RRGGBB] (0-9, A-F, a-f)");
}
color = color << 8 | 0xFF;
FactionInfo[FACTION_ID][FactionColor] = color;
return SendClientMessage(playerid, color, "This is the new color of your faction.");;
}
pawn Код:
stock HexToInt(string[]) {
new
i,
result,
tmp = string[0]
;
do {
result <<= 4;
if('0' <= tmp <= '9') {
result += tmp - '0';
continue;
}
if('A' <= tmp <= 'F') {
result += tmp - ('A' - 10);
continue;
}
if('a' <= tmp <= 'f') {
result += tmp - ('a' - 10);
continue;
}
return false;
} while((tmp = string[++i]));
return result;
}