SA-MP Forums Archive
Embedding GetPlayerColor - 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: Embedding GetPlayerColor (/showthread.php?tid=599000)



Embedding GetPlayerColor - lucamsx - 19.01.2016

How can i use GetPlayerColor as embedded color in the middle of the string?
I want to make local chat that keeps player's color in the message, but the "((" at the middle gets colored too.


Re: Embedding GetPlayerColor - AbyssMorgan - 19.01.2016

PHP код:
new buffer[256];
format(buffer,sizeof buffer,"(%d) {%06x} bla bla bla",playerid,ShiftRGBAToRGB(GetPlayerColor(playerid)));
SendClientMessageToAll(0xFFFFFFFF,buffer); 
PHP код:
//RGBA to RGB
stock ShiftRGBAToRGB(color){
    new 
rgb;
    
= (color >>> 24);
    
= (color >>> 16 0xFF);
    
= (color >>> 0xFF);
    
color = (0xFF) | ((0xFF) << 8) | (<< 16);
    return 
color;

OR
https://github.com/AbyssMorgan/SA-MP...de/SAM/RGB.inc