SA-MP Forums Archive
showing the id of the player in chat? - 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: showing the id of the player in chat? (/showthread.php?tid=191817)



showing the id of the player in chat? - Face9000 - 20.11.2010

Is there any way to show the ID of the player in chat before his message?

Ex: PLAYERNAME (ID: ): MESSAGE.


Re: showing the id of the player in chat? - Mauzen - 20.11.2010

Takes just a few lines in OnPlayerText:

pawn Код:
new name[24], txt[256];
GetPlayerName(playerid, name);
format(txt, 256, "%s (%d): %s", name, playerid, text);
SendClientMessageToAll(GetPlayerColor(playerid), txt);

return 0;   //this is important, or the message will be sent twice



AW: showing the id of the player in chat? - Cank - 20.11.2010

pawn Код:
//OnPlayerText
format(text, sizeof(text), "[%d] %s", playerid, text);
even easier, is it?


Re: showing the id of the player in chat? - Face9000 - 20.11.2010

I tried mauzen code but i get this.

Код:
C:\Documents and Settings\k\Desktop\COD5.pwn(5266) : warning 202: number of arguments does not match definition
C:\Documents and Settings\k\Desktop\COD5.pwn(5272) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.



Re: showing the id of the player in chat? - rs.pect - 20.11.2010

Logitech90, try Cank's code.


Re : Re: showing the id of the player in chat? - Amine_Mejrhirrou - 07.09.2011

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
I tried mauzen code but i get this.

Код:
C:\Documents and Settings\k\Desktop\COD5.pwn(5266) : warning 202: number of arguments does not match definition
C:\Documents and Settings\k\Desktop\COD5.pwn(5272) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
what's about that
Код:
new name[24], txt[256];
	GetPlayerName(playerid, name, 24);
	format(txt, 256, "%s (%d): {FFFFFF}%s", name, playerid, text);
	SendClientMessageToAll(GetPlayerColor(playerid), txt);