SA-MP Forums Archive
[Help] PlayerColor - 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: [Help] PlayerColor (/showthread.php?tid=558600)



[Help] PlayerColor - Arxalan - 18.01.2015

Hello , following is my PlayerTextcolor code . It send the message in another color which player chooses . but it set playercolor to black . I want to remove this function . So that player color don't get black and will be the same .

PHP код:
        new
        
temp_String[144],
        
temp_Nick[MAX_PLAYER_NAME];
        
GetPlayerName(playeridtemp_Nicksizeof(temp_Nick));
        
format(temp_Stringsizeof(temp_String), "%s : {%06x}%s"temp_Nickg_PlayerChatCol[playerid] >>> 8text);
        
SendClientMessageToAll(GetPlayerColor(playerid), temp_String);
        return 
0//To avoid the original chat to be sent. 
Thanks to a Sa-mp member who gave me this code . I forgot his name.


Re: [Help] PlayerColor - Lordzy - 18.01.2015

It's because g_PlayerChatCol[playerid] variable is set to 0 by default. Just add this to the end of OnPlayerConnect:
pawn Код:
g_PlayerChatCol[playerid] = 0xFFFFFFFF;



Re: [Help] PlayerColor - Arxalan - 18.01.2015

I think you gave me the code Lordzy .
But i have also color name changer option by /colors so i want that if player say anything his color will be the same as he choose from /colors.


Re: [Help] PlayerColor - Neculai - 18.01.2015

try this
format(temp_String, sizeof(temp_String), "{%06x}%s : {%06x}%s",GetPlayerColor(), temp_Nick, g_PlayerChatCol[playerid], text);
SendClientMessageToAll(-1,temp_String);


Re: [Help] PlayerColor - Lordzy - 18.01.2015

GetPlayerColor() - It will return black color in case if SetPlayerColor hasn't been used. You must use SetPlayerColor either under OnPlayerRequestClass or under OnPlayerSpawn.


Re: [Help] PlayerColor - Arxalan - 18.01.2015

Quote:
Originally Posted by Lordzy
Посмотреть сообщение
It's because g_PlayerChatCol[playerid] variable is set to 0 by default. Just add this to the end of OnPlayerConnect:
pawn Код:
g_PlayerChatCol[playerid] = 0xFFFFFFFF;
I already did it.
PHP код:
g_PlayerChatCol[playerid] = 0xFFFFFFFF//By default, it's white.