Loading playercolor for factions
#5

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;
}
Reply


Messages In This Thread
Loading playercolor for factions - by xAzKingx - 22.01.2015, 09:16
Re: Loading playercolor for factions - by Threshold - 22.01.2015, 10:34
Re: Loading playercolor for factions - by xAzKingx - 22.01.2015, 10:44
Re: Loading playercolor for factions - by Threshold - 22.01.2015, 11:25
AW: Loading playercolor for factions - by Nero_3D - 22.01.2015, 12:40
Re: Loading playercolor for factions - by xAzKingx - 22.01.2015, 13:14
Re: Loading playercolor for factions - by xAzKingx - 22.01.2015, 21:16
AW: Re: Loading playercolor for factions - by Nero_3D - 23.01.2015, 12:42
Re: AW: Re: Loading playercolor for factions - by xAzKingx - 23.01.2015, 15:34
AW: Loading playercolor for factions - by Nero_3D - 23.01.2015, 16:10

Forum Jump:


Users browsing this thread: 1 Guest(s)