Command to SetPlayerColor by Choice.
#1

I tryed something like this but it gives me an error with SetPlayerColor. I do not posses the necessary knowledge with these Hex colors and stuff -_-

pawn Код:
COMMAND:groupcolor(playerid, params[])
{
    new i = group[playerid][gid];
        if(groupinfo[i][leader] == playerid)
    {
        new color[7];
        if(sscanf(params, "h", color) || strlen(params) != 6)
            SendClientMessage(playerid, -1, "{FF0000}Invalid hex color!");
        else
        {
            new msg[56];
            format(msg, sizeof(msg), "{%s}Your group color has been changed!", params);
            SendClientMessage(playerid, -1, msg);
            format(groupinfo[i][GroupColor], 7, "%s", params);
                        SetPlayerColor(playerid, group[i][GroupColor]); //HexToInt is not working either. And how do i deal with the transparency parameters ? Like if i wanna set 50 as default ?
        }
    }
    else
        SendClientMessage(playerid, -1, "{FF0000}You must be a group leader to use this command!");
    return 1;
}
Reply
#2

I would change GroupColor to an integer and then:
pawn Код:
groupinfo[i][GroupColor] = (color << 8) | 0x7F; // 0x7F is alpha
SetPlayerColor(playerid, group[i][GroupColor]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)