PlayerChat

From RAGE Multiplayer Wiki

This event is triggered when a player send a message in the chat.

Server-Side
Event

 C#  JavaScript




C# Syntax


JavaScript Syntax

Parameters

  • player: Player - player, who send message
  • text: String - the text that was sent

Example

This example will gives 300 money a player if his nickname is "Modernß" and he types "sorry" in chat.

function checkChatMessage(player, text) {
	if (player.name === "Modernß" && text == "sorry") {
		player.money += 300;
	}
};

mp.events.add("playerChat", checkChatMessage);


Client-Side Event

 C#  JavaScript



C# Syntax

public delegate void OnPlayerChatDelegate(string text, CancelEventArgs cancel);

Parameters

  • text: text, expects System.String type.
  • cancel: cancel, expects RAGE.Events.CancelEventArgs type.

Example

Events.OnPlayerChat += OnPlayerChat;
public void OnPlayerChat(string text, RAGE.Events.CancelEventArgs cancel)
{
    if (text == "who is george")
    {
        RAGE.Chat.Output("He is the bossmen");
    }
    else if (text == "who is jaimuzu")
    {
        RAGE.Chat.Output("He is a beast");
    }
}


JavaScript Syntax

Parameters

  • text: String

Example

mp.events.add("playerChat", (text) => {
     if (text === "test") {
          mp.gui.chat.push("You wrote 'test' in chat.");
     }
});


See also

Checkpoint

Colshape

Entity

Player

Streaming

Vehicle

Waypoint