PlayerQuit: Difference between revisions
No edit summary |
No edit summary |
||
| Line 4: | Line 4: | ||
* '''player''' - player, which quit from the server. | * '''player''' - player, which quit from the server. | ||
* '''exitType ''' - exit type from the server: | * '''exitType ''' - exit type from the server: | ||
**'disconnect' | **''disconnect'' | ||
**timeout | **timeout | ||
**kicked | **kicked | ||
Revision as of 15:31, 28 December 2016
This event is triggered when a player quit from the server.
Parameters
- player - player, which quit from the server.
- exitType - exit type from the server:
- disconnect
- timeout
- kicked
- reason - reason of quit from the server if exit type is "kicked".
Example
This example outputs chat message, when player quits or kicked from the server.
Server-side
function playerQuitHandler(player, exitType, reason) {
if (exitType != "kicked") {
var str = player.name + " quit.";
} else {
var str = player.name + " kicked. Reason: " + reason + ".";
}
console.log(str);
}
mp.events.add("playerQuit", playerQuitHandler);