02.12.2018, 13:12
Hello guys, I'm using the function HexToInt, but I have a problem.
When I try to set the player's color to red it sets it as blue.
Here is my code:
And here is my HexToInt function:
When I try to set the player's color to red it sets it as blue.
Here is my code:
PHP код:
format(TheColor, sizeof(TheColor), "0xFF0000FF");
SetPlayerColor(playerid, HexToInt(TheColor));
PHP код:
stock HexToInt( string[ ] )
{
if( string[ 0 ] == 0 ) return ( 0 );
new i;
new cur = 1;
new res = 0;
for( i = strlen( string ); i > 0; i -- )
{
if( string[ i - 1 ] < 58 )
{
res = res + cur * ( string[ i - 1 ] - 48 );
}
else
{
res = res + cur * ( string[ i - 1 ] - 65 + 10 );
cur = cur * 16;
}
}
return ( res );
}