/color
#8

Come on dude have some patience!

Quote:
Originally Posted by RajatPawar
Посмотреть сообщение
I am pretty sure that the "x" specifier also handles normal numbers, making the job more easier! Correct me if I am wrong. Cheers (source?)
No. Because, for example, 11 (0x11) in the hexadecimal number system is 17 in the decimal number system.


pawn Код:
CMD:color(playerid, params[])
{
    new color;
   
    if(sscanf(params, "x", color))
        return SendClientMessage(playerid, -1, "Invalid input");
       
    color <<= 8; // shift left to make room for alpha
    color |= 0xFF; // Add the alpha
   
    SetPlayerColor(playerid, color);
    return 1;
}
Pro tip: use the Programmer's mode in Windows Calculator to help you with hexadecimal operations.
Reply


Messages In This Thread
[FIXED] /color - by AiRaLoKa - 14.05.2014, 12:30
Re: /color - by AiRaLoKa - 14.05.2014, 12:38
Re: /color - by Vince - 14.05.2014, 12:49
Re: /color - by AiRaLoKa - 14.05.2014, 12:51
Re: /color - by RajatPawar - 14.05.2014, 12:51
Re: /color - by AiRaLoKa - 14.05.2014, 13:00
Re: /color - by AiRaLoKa - 14.05.2014, 13:11
Re: /color - by Vince - 14.05.2014, 13:22
Re: /color - by Konstantinos - 14.05.2014, 13:44
Re: /color - by AiRaLoKa - 15.05.2014, 00:53

Forum Jump:


Users browsing this thread: 4 Guest(s)