跳到主要内容

OnPlayerText

Description

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

NameDescription
playeridThe 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 string[144];
format(string, sizeof (string), "(%d) %s", playerid, text);
SendPlayerMessageToAll(playerid, string);
return 0; // ignore the default text and send the custom one
}

Notes

提示

This callback can also be called by NPC.

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.