Lumaktaw patungo sa pangunahing content

OnPlayerText

Description

This callback is called when a player sends a message in chat.

NameDescription
playeridThe ID of the player who sent the message.
text[]The content of the message that the player sent.

Returns

It is always called first in filterscripts so returning 0 on it blocks other scripts from processing it.

Examples

public OnPlayerText(playerid, text[])
{
new string[144];
format(string, sizeof (string), "(%d) %s", playerid, text);
SendPlayerMessageToAll(playerid, string);

// Returning 0 ignores the default message format and sends the custom one instead.
// Returning 1 will result in the message being duplicated, as the default message will also be sent.
return 0;
}

Notes

tip

This callback can also be called by NPC.

tip

By default, this callback sends a message containing the content of the message, the player's name, and their ID. Returning 0 will ignore this default behaviour, as demonstrated in the code example above.

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

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