How to use GetPlayerColor with format.
#1

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));
Reply
#2

%x I believe? Color suppose to be Hex
Reply
#3

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.
Reply
#4

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+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)