SA-MP Forums Archive
How to use GetPlayerColor with format. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to use GetPlayerColor with format. (/showthread.php?tid=409078)



How to use GetPlayerColor with format. - Mellnik - 20.01.2013

How to I insert the player's color so that the string gets colored?

pawn Код:
new string[144];

format(string, sizeof(string), "% /*<-which specifier there? */ Hello", GetPlayerColor(playerid));



Re: How to use GetPlayerColor with format. - Income - 20.01.2013

%x I believe? Color suppose to be Hex


Re: How to use GetPlayerColor with format. - Vince - 20.01.2013

If you mean an embedded color, then the right thing to do is:
pawn Код:
format(string, sizeof(string), "{%06x}Hello!", (GetPlayerColor(playerid) >>> 8));
The right shift (the three chevrons) will strip off the alpha value.


AW: Re: How to use GetPlayerColor with format. - Mellnik - 20.01.2013

Quote:
Originally Posted by Vince
Посмотреть сообщение
If you mean an embedded color, then the right thing to do is:
pawn Код:
format(string, sizeof(string), "{%06x}Hello!", (GetPlayerColor(playerid) >>> 8));
The right shift (the three chevrons) will strip off the alpha value.
Awesome, thanks! rep+