OnVehicleExit

From Multi Theft Auto: Wiki
Revision as of 15:24, 2 December 2006 by Talidan (talk | contribs)
Jump to navigation Jump to search

This event is triggered when a player leaves a vehicle.

Syntax

void onVehicleExit ( player player, int seat, player jacker ) 

Variables

  • The source of this event is the vehicle which was exited
  • player: A player element representing the player who exited the vehicle
  • seat: An integer representing the seat in which the player exited from
  • jacker: A player element representing the player who jacked the driver

Example

This example adds a 'moto' helmet to a player when he gets on a nrg bike, and removes it when he gets off.

addEventHandler ( "onVehicleEnter", getRootElement(), "onEnterVehicle" )
function onEnterVehicle ( player, seat, jacked )
  if ( getVehicleID ( source ) == 522 ) then -- if its a nrg
    addPlayerClothes ( player, "moto", "moto", 16 ) -- add the helmet
  end
end

addEventHandler ( "onVehicleExit", getRootElement(), "onExitVehicle" )
function onExitVehicle ( player, seat, jacked )
  if ( getVehicleID ( source ) == 522 ) then -- if its a nrg
    removePlayerClothes ( player, 16 ) -- remove the helmet
  end
end

See Also

Shared