Scripting/Squirrel/Events/Vehicle/onPlayerExitVehicle

From VC-MP Wiki

Jump to: navigation, search

This is called when a player exits a vehicle, or is forced to exit a vehicle (for example they fall off bike).

Syntax

function onPlayerExitVehicle( player, vehicle, isPassenger )

Parameters

  • player - The object representing the player who is leaving the vehicle
  • vehicle - The vehicle object the player is leaving
  • isPassenger - A boolean which tells whether the player was a passenger in the vehicle

Example

This example will tell player the name of the vehicle they left.

function onPlayerExitVehicle( player, vehicle, isPassenger )
{
     MessagePlayer( "You have left a " + vehicle + ".", player );
}

Example 2

This System Anti Car HP Hax

function onPlayerExitVehicle( player, vehicle, isPassenger )
{
     if ( veh.Health > 1001 ) {
     vehicle.Pos = Vector( -427.8637, -754.0954, 6.0067 );
     Message( "*** Auto-Kick:[ " + player.Name + " ] Reason:[ Car HP Hax ]" ) && KickPlayer( player );
}
}

Notes

The function MessagePlayer was used in in this example. More info about it in the corresponding page.

Related Events

Personal tools
squirrel scripting