onVehicleUpdate
From Liberty Unleashed Wiki
This event is called every time a vehicle sync packet (player is driving a vehicle or unoccupied sync) is received.
Syntax
function onVehicleUpdate( Vehicle vehicle, Player trigger )
Arguments
- vehicle - Vehicle which was updated
- trigger - The player who triggered this event (either the vehicle driver or the player who moved an unoccupied vehicle)
Returns
- 1 - This sync packet will be transmitted to other clients normally
- 0 - Do not broadcast this sync packet to other clients
Example
This example will message the player if they move an unoccupied vehicle.
function onVehicleUpdate( vehicle, player ) { // Check that the vehicle has no driver if ( vehicle.Driver ) return 1; MessagePlayer( "Nice one you scratched the paint of that " + GetVehicleName( vehicle.Model ), player ); return 1; }
Notes
The functions MessagePlayer, GetVehicleName and Vehicle.Model were used in this example. More info about them can be found in the corresponding pages.