06.10.2011, 16:34
Use this function:
Use like this:
pawn Код:
stock hexstr( string[ ] ) // Function by ******
{
new ret, val, i;
if( string[ 0 ] == '0' && ( string[ 1 ] == 'x' || string[ 1 ] == 'X' ) ) i = 2;
while( string[ i ] )
{
ret <<= 4;
val = string[ i ++ ] - '0';
if( val > 0x09 ) val -= 0x07;
if( val > 0x0F ) val -= 0x20;
if( val < 0x01 ) continue;
if( val < 0x10 ) ret += val;
}
return ret;
}
Код:
new Hexcolor[ 26 ]; format( Hexcolor, 26, "#33CC00" ); SetPlayerColor( playerid, hexstr( Hexcolor ) );