OnPlayerText

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 15:52, 6 August 2017
OstGot (Talk | contribs)

← Previous diff
Revision as of 12:40, 9 August 2017
OstGot (Talk | contribs)

Next diff →
Line 8: Line 8:
{{Returns|Returning '''0''' in this callback will stop the text from being sent to all players. {{Returns|Returning '''0''' in this callback will stop the text from being sent to all players.
-* It is always called first in filterscripts so returning 0 there blocks other filterscripts from seeing it.}}+* It is always called first in filterscripts so returning 0 there blocks other scripts from seeing it.}}
{{Example}} {{Example}}

Revision as of 12:40, 9 August 2017



Description:

Called when a player sends a chat message.


Parameters:
(playerid, text[])
playeridThe ID of the player who typed the text.
text[]The text the player typed.


Return Values:

Returning 0 in this callback will stop the text from being sent to all players.
  • It is always called first in filterscripts so returning 0 there blocks other scripts from seeing it.


Example Usage:

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
}

Related Callbacks

The following callbacks might be useful as well, as they are related to this callback in one way or another.


Related Functions

The following functions might be useful, as they're related to this callback in one way or another.

Personal tools
In other languages