SA-MP Forums Archive
Playerid 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Playerid in chat (/showthread.php?tid=78228)



Playerid in chat - Remi-X - 18.05.2009

How do I add a playerid in the chatbox, like so:
"(0)Remi: Test"
It must be possible, i've seen it on more servers.


Re: Playerid in chat - OmeRinG - 18.05.2009

In the public "OnPlayerText":
new formattext[256];
format(formattext,sizeof(formattext),"%s (ID: %d)",text,playerid);
SendPlayerMessage(playerid,formattext);
return 0;



Re: Playerid in chat - MenaceX^ - 18.05.2009

Eh? Why should he use 256 cells?


Re: Playerid in chat - Karlip - 18.05.2009

+ your little snippet will only work for you,since you have another SendClientMessageToAll defined.


Re: Playerid in chat - Jefff - 18.05.2009

Quote:
Originally Posted by Remi-X
How do I add a playerid in the chatbox, like so:
"(0)Remi: Test"
It must be possible, i've seen it on more servers.
Код:
GetPlayerName
format
SetPlayerName
SendPlayerMessageToAll
SetPlayerName // back to original name



Re: Playerid in chat - Weirdosport - 18.05.2009

Quote:
Originally Posted by OmeRinG
In the public "OnPlayerText":
new formattext[256];
format(formattext,sizeof(formattext),"%s (ID: %d)",text,playerid);
SendPlayerMessage(playerid,formattext);
return 0;
They will send:

Remi: Message goes here (ID: 0)

(Also it should be SendPlayerMessageToAll)


Re: Playerid in chat - OmeRinG - 18.05.2009

Quote:
Originally Posted by Karlip
+ your little snippet will only work for you,since you have another SendClientMessageToAll defined.
This is not a sendclientmessagetoall, this is sendplaymessage... I got it wrong and didn't do SendPlayerMessageToAll but this is differrent from sendclientmessage it sends a message that look like a player sent it...
and MenaceX, I used 256 cells because this is a player message and it should have maximum cells, so player's messages are not cut in the end


Re: Playerid in chat - Weirdosport - 18.05.2009

Quote:
Originally Posted by OmeRinG
and MenaceX, I used 256 cells because this is a player message and it should have maximum cells, so player's messages are not cut in the end
Read THIS.

The maximum player message is only 128 cells long.


Re: Playerid in chat - MenaceX^ - 18.05.2009

I'd rather done it with SendClientMessageToAll, also I still don't get why you use 256 cells.

Added due to Omering's reply:
Quote:
Originally Posted by OmeRinG
and MenaceX, I used 256 cells because this is a player message and it should have maximum cells, so player's messages are not cut in the end
I guess you haven't read the topic about 256 cells. The screen can't to contain longer than 128 characters per line.
Though it's a wasted array - once your server has many players it will be lagging as hell.


Re: Playerid in chat - OmeRinG - 18.05.2009

Quote:
Originally Posted by MenaceX^
I'd rather done it with SendClientMessageToAll, also I still don't get why you use 256 cells.

Added due to Omering's reply:
Quote:
Originally Posted by OmeRinG
and MenaceX, I used 256 cells because this is a player message and it should have maximum cells, so player's messages are not cut in the end
I guess you haven't read the topic about 256 cells. The screen can't to contain longer than 128 characters per line.
Though it's a wasted array - once your server has many players it will be lagging as hell.
ye just read it, didn't know that...
well atlest i've learnt something new