Playerid in chat
#1

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.
Reply
#2

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

Eh? Why should he use 256 cells?
Reply
#4

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

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
Reply
#6

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)
Reply
#7

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
Reply
#8

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.
Reply
#9

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.
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)