Onplayertext - help - 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: Onplayertext - help (
/showthread.php?tid=317106)
Onplayertext - help -
Kelvin_Cesar - 10.02.2012
Hi! I wonder, how do I change what the player writes.
Example:
Change to
Quote:
SA_MP to say: '[anything]'
|
is only an example,Can someone help me? Thanks!
Re: Onplayertext - help -
2KY - 10.02.2012
return 0 on OnPlayerText, get the players name, format the message in a string, and send it to everyone using SendClientMessageToAll.
Re: Onplayertext - help -
Kelvin_Cesar - 10.02.2012
How i format the message in a string?
Re: Onplayertext - help -
2KY - 10.02.2012
pawn Код:
public OnPlayerText(playerid, text[])
{
new
playerName[MAX_PLAYER_NAME],
string[128]
;
GetPlayerName(playerid, playerName, sizeof(playerName));
format(string, sizeof(string), "%s to say: [anything]", playerName);
SendClientMessageToAll(0xFFFFFFFF, string);
return 0;
}
Will make them literally say
PLAYERNAME to say: [anything]
every time they speak, but if I didn't read correctly and you just want them "to say:" then..
pawn Код:
public OnPlayerText(playerid, text[])
{
new
playerName[MAX_PLAYER_NAME],
string[128]
;
GetPlayerName(playerid, playerName, sizeof(playerName));
format(string, sizeof(string), "%s to say: %s", playerName, text);
SendClientMessageToAll(0xFFFFFFFF, string);
return 0;
}
Re: Onplayertext - help -
Kelvin_Cesar - 10.02.2012
Okay! Very Thanks +REP (can close the topic)