NPC:OnClientMessage

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 05:55, 2 February 2014
1234567890 (Talk | contribs)
(polish link)
← Previous diff
Current revision
Ikkentim (Talk | contribs)
(Added return value)
Line 8: Line 8:
{{Param|color|The color the ClientMessage is.}} {{Param|color|The color the ClientMessage is.}}
{{Param|text[]|The actual message.}} {{Param|text[]|The actual message.}}
 +
 +{{NoReturnCallback}}
'''Example:''' '''Example:'''

Current revision



NPC:OnClientMessage was added in SA-MP 0.3a This NPC callback was added in SA-MP 0.3a and will not work in earlier versions!


Description:

This callback gets called whenever the NPC sees a ClientMessage. This will be everytime a SendClientMessageToAll function is used and everytime a SendClientMessage function is sent towards the NPC. This callback won't be called when someone says something. For a version of this with player text, see NPC:OnPlayerText.


Parameters:
(color, text[])
colorThe color the ClientMessage is.
text[]The actual message.


Return Values:

This callback does not handle returns.


Example:

public OnClientMessage(color, text[])
{
    if(strfind(text,"Bank Balance: $0") != -1) SendChat("I am poor :(");
}

Related Callbacks

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

In other languages