OnPlayerQuit: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
Line 16: | Line 16: | ||
* "Bad Connection" | * "Bad Connection" | ||
* "Timed out" | * "Timed out" | ||
{{New feature|3|1.0| | {{New feature|3|1.0| | ||
Line 34: | Line 33: | ||
function quitPlayer ( quitType ) | function quitPlayer ( quitType ) | ||
-- we store the player's name | -- we store the player's name | ||
local quittingPlayerName = | local quittingPlayerName = getPlayerName ( source ) | ||
-- and send the message to the server | -- and send the message to the server | ||
outputChatBox ( quittingPlayerName .. " has left the server (" .. quitType .. ")" ) | outputChatBox ( quittingPlayerName .. " has left the server (" .. quitType .. ")" ) |
Revision as of 11:53, 27 August 2009
This event is triggered when a player disconnects from the server.
Parameters
string quitType, string reason, element responsibleElement
- quitType: How the player left.
This argument can be:
- "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
The source of this event is the player that left the server.
Example
This example gets the quitting client's name and outputs that he is gone
-- we register quitPlayer as a handler for the event function quitPlayer ( quitType ) -- we store the player's name local quittingPlayerName = getPlayerName ( source ) -- and send the message to the server outputChatBox ( quittingPlayerName .. " has left the server (" .. quitType .. ")" ) end addEventHandler ( "onPlayerQuit", getRootElement(), quitPlayer )
See Also
Player events
- onPlayerACInfo
- onPlayerBan
- onPlayerChangeNick
- onPlayerChat
- onPlayerClick
- onPlayerCommand
- onPlayerConnect
- onPlayerContact
- onPlayerDamage
- onPlayerJoin
- onPlayerLogin
- onPlayerLogout
- onPlayerMarkerHit
- onPlayerMarkerLeave
- onPlayerModInfo
- onPlayerMute
- onPlayerNetworkStatus
- onPlayerPickupHit
- onPlayerPickupLeave
- onPlayerPickupUse
- onPlayerPrivateMessage
- onPlayerQuit
- onPlayerScreenShot
- onPlayerSpawn
- onPlayerStealthKill
- onPlayerTarget
- onPlayerUnmute
- onPlayerVehicleEnter
- onPlayerVehicleExit
- onPlayerVoiceStart
- onPlayerVoiceStop
- onPlayerWasted
- onPlayerWeaponFire
- onPlayerWeaponSwitch
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled