Squirrel/Server/Functions/Vehicles/EngineDamage

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(added info about class member EngineDamage)

Revision as of 14:24, 7 July 2011

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events


This EngineDamage class member returns or sets level of engine damage (0 - 150; 0 = undamaged engine; 250 = engine is burning)

Syntax

You can either returns or sets value using this member:

  1. int Vehicle.EngineDamage
  1. Vehicle.EngineDamage = int iDmg

Arguments

  • iDmg = 0 - 150; 0 = undamaged engine; 250 = engine is burning and car will crash

Example 1. returning

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "getenginedamage" )
  5. {
  6. if ( player.Vehicle ) MessagePlayer( "Vehicle's engine damage: " + player.Vehicle.EngineDamage, player );
  7. }
  8. return 1;
  9. }
  10.  

Notes

The functions Player.Vehicle, MessagePlayer and event onPlayerCommand were used in this example. More info about them in the corresponding pages.

Example 2. Setting value

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "setenginedamage" )
  5. {
  6. if ( player.Vehicle )
  7. {
  8. player.Vehicle.EngineDamage = 250;
  9. MessagePlayer( "Attention ! Vehicle's engine is burning !",player);
  10. }
  11.  
  12. }
  13. return 1;
  14. }
  15.  

Notes

The functions Player.Vehicle, MessagePlayer and event onPlayerCommand were used in this example. More info about them in the corresponding pages.


Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox