onVehicleHealthChange
From Liberty Unleashed Wiki
This is called when the health of a vehicle changes.
Syntax
function onVehicleHealthChange( Vehicle veh, float oldHealth, float newHealth )
Arguments
- veh - The pointer of the vehicle which health was changed
- oldHealth - The amount of health vehicle had before the change
- newHealth - The current health
Returns
This event does not handle return values.
Example
This will tell the vehicle driver that they have damaged their vehicle.
function onVehicleHealthChange( veh, oldhp, newhp ) { if ( oldhp > newhp ) { local driver = veh.Driver; if ( driver ) { MessagePlayer( "Seems you just scratched your vehicle.", driver ); } } return 1; }
Notes
The functions MessagePlayer and Vehicle.Driver were used in this example. More info about them can be found in the corresponding pages.