warning Not Translated
This page has not been translated into the language that your browser requested yet. The English content is being shown as a fallback.
If you want to contribute a translation for this page then please click here.
OnPlayerText
Description
This callback is called when a player sends a chat message.
Name | Description |
---|---|
playerid | The ID of the player who typed the text. |
text[] | The text the player typed. |
Returns
It is always called first in filterscripts so returning 0 there blocks other scripts from seeing it.
Examples
public OnPlayerText(playerid, text[])
{
new pText[144];
format(pText, sizeof (pText), "(%d) %s", playerid, text);
SendPlayerMessageToAll(playerid, pText);
return 0; // ignore the default text and send the custom one
}
Notes
tip
This callback can also be called by NPC.
Related Callbacks
The following callbacks might be useful, as they're related to this callback in one way or another.
- OnPlayerCommandText: Called when a player types a command.
Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- SendPlayerMessageToPlayer: Force a player to send text for one player.
- SendPlayerMessageToAll: Force a player to send text for all players.