PlayerJoin: Difference between revisions
No edit summary |
|||
| Line 6: | Line 6: | ||
=='''Example'''== | =='''Example'''== | ||
This example outputs chat message, when player joins to the server. | This example outputs chat message, when player joins to the server. | ||
<div class="header" style="background-color: #E4F1FE; color: #4183D7; width: 100%; border: | <div class="header" style="background-color: #E4F1FE; color: #4183D7; width: 100%; border: 2px solid #81CFE0;"> | ||
<div style="margin: 2px 0px 2px 10px;"><b>Server-side</b></div> | <div style="margin: 2px 0px 2px 10px;"><b>Server-side</b></div> | ||
</div> | </div> | ||
<div class="content" style="background-color: #E4F1FE; color: #4183D7; width: 100%; border: | <div class="content" style="background-color: #E4F1FE; color: #4183D7; width: 100%; border: 2px solid #81CFE0; display: flex; justify-content: center; align-items: center;"> | ||
<syntaxhighlight lang="javascript" style="width: 98%; background-color: #E4F1FE;"> | <syntaxhighlight lang="javascript" style="width: 98%; background-color: #E4F1FE;"> | ||
function playerJoinHandler(player) { | function playerJoinHandler(player) { | ||
Revision as of 11:45, 28 December 2016
This event is triggered when a player joins the server.
Parameters
- player - player, which joined to the server.
Example
This example outputs chat message, when player joins to the server.
Server-side
function playerJoinHandler(player) {
console.log(player.name + " join.");
}
mp.events.add("playerJoin", playerJoinHandler);