Squirrel/Server/Functions/Vehicles/EngineDamage

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Arguments)
Line 12: Line 12:
 
==Arguments==
 
==Arguments==
  
* '''iDmg''' = 0 - 150; 0 = undamaged engine; 250 = engine is burning and car will crash
+
* '''iDmg''' = engine damage level, max. value is 250
  
 
==Example 1. returning ==
 
==Example 1. returning ==

Revision as of 17:02, 7 July 2011

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


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

Syntax

You can either return or set the value using this member:

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

Arguments

  • iDmg = engine damage level, max. value is 250

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