OnPlayerQuit

From Multi Theft Auto: Wiki
Revision as of 16:12, 14 September 2007 by Arc (talk | contribs)
Jump to navigation Jump to search

This event is triggered when a player leaves the game, for whatever reason.

Syntax

void onPlayerQuit ( string reason )   

Example

This example destroys the blips attached to a player and removes him from his team when he quits.

function onPlayerQuit ()                    -- When the player quits
	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