OnPlayerQuit: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
(Updated, removed outdated example)
Line 1: Line 1:
__NOTOC__  
__NOTOC__
This event is triggered when a player leaves the game, for whatever reason.
{{Server event}}
This event is triggered when a player disconnects from the server.


==Syntax==  
==Parameters==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
void onPlayerQuit ( string reason
string reason
</syntaxhighlight>  
</syntaxhighlight>  


==Example==
*'''reason''': A string containing the reason why the player left.
This example destroys the blips attached to a player and removes him from his team when he quits.
 
<syntaxhighlight lang="lua">
==Source==
function onPlayerQuit ()                    -- When the player quits
The [[event system#Event source|source]] of this event is the [[player]] that left the server.
destroyBlipsAttachedTo ( source )  -- Destroy his blips
removePlayerFromTeam ( source )    -- And remove him from the team he was in
end


addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) -- Tell MTA to call above function when the event occurs
==See Also==
</syntaxhighlight>
{{Event_functions}}
[[Category:Needs Example]]

Revision as of 17:02, 14 September 2007

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

Parameters

string reason
  • reason: A string containing the reason why the player left.

Source

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

See Also