PlayerQuit: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
Line 1: Line 1:
This event is triggered when a player quit from the server.
This event is triggered when a player quit from the server.


=='''Parameters'''==
==Parameters==
* '''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
* '''reason''' - reason of quit from the server if exit type is "kicked".
* '''reason''' - reason of quit from the server if exit type is "kicked".


=='''Example'''==
==Example==
This example outputs chat message, when player quits or kicked from the server.
This example outputs chat message, when player quits or kicked from the server.
<div class="header" style="background-color: #E4F1FE; color: #4183D7; width: 100%; border: 2px solid #81CFE0;">
<div class="header" style="background-color: #E4F1FE; color: #4183D7; width: 100%; border: 2px solid #81CFE0;">

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);