ID problems - 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: ID problems (
/showthread.php?tid=559479)
ID problems -
SecretBoss - 23.01.2015
Can anyone help with the IDs in front of the name for ex. MyName(ID): <My chat text here>
I have this code where I found in forums
pawn Код:
public OnPlayerText(playerid, text[])
{
new string[128], playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "%s(%d): %s",playername, playerid, text);
SendClientMessageToAll(GetPlayerColor(playerid),string);
return 0;
}
But the name in chat is black can someone help me?
Re: ID problems -
Lenon - 23.01.2015
In this line change color:
pawn Код:
SendClientMessageToAll(COLOR_CODE_HERE, string);
Re: ID problems -
SecretBoss - 23.01.2015
Yes but I want to take the color from tab
Re: ID problems -
nezo2001 - 23.01.2015
All you can to do to change the message color or the name of the player color what do you mean here ?
Re: ID problems -
SecretBoss - 23.01.2015
I want when someone telling something in chat to appear like this SecretBoss(ID): but not with a selected color with the color which the player has when he joined in the server (Tab's color)
Re: ID problems -
Lenon - 23.01.2015
Well then the code is ok. Its black because your name is black in game.
Put this OnPlayerSpawn just for testing:
pawn Код:
SetPlayerColor(playerid, 0xFF0000FF); // remove me when testing is over
Now write something in chat and see whats the color of chat.
And you can change this:
pawn Код:
format(string, sizeof(string), "%s(%d): %s",playername, playerid, text);
to this
pawn Код:
format(string, sizeof(string), "%s(%d): {FFFFFF}%s",playername, playerid, text);
Now only player name in chat will be as player color, text will be white.
Re: ID problems -
SecretBoss - 23.01.2015
ok I will test it in some minutes I am scripting something other now
And when I tried the script I had orange color in tab no black
Re: ID problems -
nezo2001 - 23.01.2015
Btw here is the right way:
PHP код:
format(string,128,"{%06x}%s (%d): {FFFFFF}%s",GetPlayerColor(playerid) >>> 8, PlayerName(playerid), playerid, text);
SendClientMessageToAll(-1, string);
Re: ID problems -
SecretBoss - 23.01.2015
its not working