PlayerChat: Difference between revisions
No edit summary |
(Made example look cooler) |
||
| Line 6: | Line 6: | ||
==Example== | ==Example== | ||
This example kick player if his nickname "Modernß" and he | This example will kick a player if his nickname is "Modernß" and he types "хай гэрлз" in chat. | ||
<div class="header" style="background-color: #408DAE; color: #FFFFFF; border: 2px solid #408DAE;"> | |||
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div> | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
| Line 22: | Line 24: | ||
); | ); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</div> | |||
==See also== | ==See also== | ||
[[Category:Player Events API]] | [[Category:Player Events API]] | ||
Revision as of 19:58, 18 September 2017
This event is triggered when player send message in the chat.
Parameters
- player - player, who send message.
- text - sent text. (Rly? Wow)
Example
This example will kick a player if his nickname is "Modernß" and he types "хай гэрлз" in chat.
Server-Side
let checkChatMessage = (player, text) => {
let playerNickname = player.name;
if ((playerNickname == "Modernß") && (text == "хай гэрлз")) {
player.kick();
};
};
mp.events.add(
{
"playerChat": checkChatMessage
}
);