onPlayerQuit | Multi Theft Auto: Wiki Skip to content

onPlayerQuit

Client-side
Server-side
Shared

This event is triggered when a player disconnects from the server.

Parameters

string quitType, string reason, element responsibleElement
  • quitType: How the player left. Possible values: "Unknown" "Quit" "Kicked" "Banned" "Bad Connection" "Timed out"
  • reason: If the player was kicked or banned, the reason given goes here. If the player was not kicked or banned, this will be false.
  • responsibleElement: The element that was responsible for kicking or banning the player. This is commonly another player, but can also be the console element.

Source

element: The source of this event is the player that left the server.

Canceling

This event cannot be canceled.

Code Examples

server

This example gets a quitting player's name and outputs that they left the server.

-- we register quitPlayer as a handler for the event
addEventHandler("onPlayerQuit", root,
function(quitType)
outputChatBox(getPlayerName(source).." has left the server ("..quitType..")")
end
)

See Also