onVehicleHealthChange

From Liberty Unleashed Wiki
Revision as of 02:53, 11 December 2010 by Juppi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This is called when the health of a vehicle changes.

Syntax

  1. 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.

  1.  
  2. function onVehicleHealthChange( veh, oldhp, newhp )
  3. {
  4. if ( oldhp > newhp )
  5. {
  6. local driver = veh.Driver;
  7. if ( driver )
  8. {
  9. MessagePlayer( "Seems you just scratched your vehicle.", driver );
  10. }
  11. }
  12. return 1;
  13. }
  14.  

Notes

The functions MessagePlayer and Vehicle.Driver were used in this example. More info about them can be found in the corresponding pages.

Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox