OnClientPlayerQuit: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(12 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
[[ | __NOTOC__ | ||
{{Client event}} | |||
This event is triggered when a '''remote''' player quits the game or leaves the server. It '''will not''' get triggered on the source player's client. (Use [[onClientResourceStop]] to save client side data when the local player quits.) | |||
==Parameters== | |||
== | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
string reason | |||
</syntaxhighlight> | </syntaxhighlight> | ||
*'''reason''': A string representing the reason why the player quit. | |||
** "Unknown" | |||
** "Quit" | |||
** "Kicked" | |||
** "Banned" | |||
** "Bad Connection" | |||
** "Timed out" | |||
==Source== | |||
The [[event system#Event source|source]] of this event is the [[player]] that quit the game. | |||
==Example== | ==Example== | ||
This example | This example prints a message in the chatbox when a remote player leaves the server. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function onQuitGame( reason ) | |||
outputChatBox ( getPlayerName( source ).." has left the server ("..reason..")" ) | |||
end | |||
addEventHandler( "onClientPlayerQuit", getRootElement(), onQuitGame ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | |||
===Client player events=== | |||
{{Client_player_events}} | |||
===Client event functions=== | |||
{{Client_event_functions}} |
Latest revision as of 17:15, 23 August 2014
This event is triggered when a remote player quits the game or leaves the server. It will not get triggered on the source player's client. (Use onClientResourceStop to save client side data when the local player quits.)
Parameters
string reason
- reason: A string representing the reason why the player quit.
- "Unknown"
- "Quit"
- "Kicked"
- "Banned"
- "Bad Connection"
- "Timed out"
Source
The source of this event is the player that quit the game.
Example
This example prints a message in the chatbox when a remote player leaves the server.
function onQuitGame( reason ) outputChatBox ( getPlayerName( source ).." has left the server ("..reason..")" ) end addEventHandler( "onClientPlayerQuit", getRootElement(), onQuitGame )
See Also
Client player events
- onClientPlayerChangeNick
- onClientPlayerChoke
- onClientPlayerDamage
- onClientPlayerHeliKilled
- onClientPlayerHitByWaterCannon
- onClientPlayerJoin
- onClientPlayerPickupHit
- onClientPlayerPickupLeave
- onClientPlayerQuit
- onClientPlayerRadioSwitch
- onClientPlayerSpawn
- onClientPlayerStealthKill
- onClientPlayerStuntFinish
- onClientPlayerStuntStart
- onClientPlayerTarget
- onClientPlayerVehicleEnter
- onClientPlayerVehicleExit
- onClientPlayerVoicePause
- onClientPlayerVoiceResumed
- onClientPlayerVoiceStart
- onClientPlayerVoiceStop
- onClientPlayerWasted
- onClientPlayerWeaponFire
- onClientPlayerWeaponSwitch
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled