OnPlayerText

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 22:11, 24 September 2011
LaZ (Talk | contribs)
(using functions that are related is a good idea.)
← Previous diff
Revision as of 21:32, 31 January 2014
Connor Mead (Talk | contribs)

Next diff →
Line 1: Line 1:
{{Scripting}} {{Scripting}}
-{{Title}} 
{{Description|Called when a player sends a chat message.}} {{Description|Called when a player sends a chat message.}}
Line 29: Line 28:
[[Category:Scripting Callbacks]] [[Category:Scripting Callbacks]]
 +
 +[[fr:OnPlayerText]]

Revision as of 21:32, 31 January 2014



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


public OnPlayerText(playerid, text[])
{
    new textv2[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof (name));
    format(textv2, sizeof (textv2), "%d >> %s: %s", playerid, name, text);
    SendPlayerMessageToAll(playerid, textv2);
    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.

In other languages