Playerid in a chatbox? - 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 a chatbox? (
/showthread.php?tid=170490)
Playerid in a chatbox? -
AiVAMAN - 23.08.2010
How do I make playerid show when player sends a message?
I was trying to make it like this:
pawn Код:
public OnPlayerText(playerid, text[])
{
new output[256];
format(output, sizeof(output), "[%d] %s", playerid, text);
SendClientMessageToAll(COLOR_WHITE, output);
return 0;
}
It only shows playerid and a message. But it has to be: Player name [player id] message
Like: AivaMan [0]: hello world.
Any other ideas?
Re: Playerid in a chatbox? -
Hiddos - 23.08.2010
pawn Код:
public OnPlayerText(playerid, text[])
{
new string[128];
GetPlayerName(playerid, string, sizeof string);
format(string, sizeof string, "%s [%d]: %s", string, playerid, text);
SendClientMessageToAll(COLOR_WHITE, string);
return 0;
}
Re: Playerid in a chatbox? -
[XST]O_x - 23.08.2010
pawn Код:
public OnPlayerText(playerid, text[])
{
new output[256];
format(output, sizeof(output), "[%d] %s", playerid, text);
SendPlayerMessageToAll(playerid,output);
return 0;
}
Re: Playerid in a chatbox? -
AiVAMAN - 23.08.2010
Quote:
Originally Posted by Hiddos
pawn Код:
public OnPlayerText(playerid, text[]) { new string[128]; GetPlayerName(playerid, string, sizeof string); format(string, sizeof string, "%s [%d]: %s", string, playerid, text); SendClientMessageToAll(COLOR_WHITE, string); return 0; }
|
Damn it, forgot the player name.
Re: Playerid in a chatbox? -
Retardedwolf - 23.08.2010
Quote:
Originally Posted by [XST]O_x
|
After reading ******'s "Never use 256 Arrays" I learnt that the player can only type 128 as max.