05.09.2013, 12:27
pawn Код:
/** BY DRACOBLUE
* Return the value of an hex-string
* @param string
*/
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;
}
The function I supplied you will convert your hexidecimal into an integer for you. You can always use an integer as a colour on functions, for example:
pawn Код:
// Player's Colour
SetPlayerColor( playerid, -1 ); // Will give white
//Client message
SendClientMessage( playerid, -255, "Hello World!" ); // Might give black (haven't tried)
I hope I helped!