Squirrel/Server/Functions/Vehicles/Health
From Liberty Unleashed Wiki
(Difference between revisions)
(Created page with '{{Squirrel/Title|Vehicle.Health}} This ''Vehicle'' class member returns or sets the vehicle engine health. Note that max. vehicle health is 1000.0. == Syntax == You can either …') |
(→Example 1. Returning) |
||
Line 14: | Line 14: | ||
== Example 1. Returning == | == Example 1. Returning == | ||
− | |||
− | |||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | + | function onPlayerCommand( pPlayer, szCommand, szText ) | |
+ | { | ||
+ | if ( szCommand == "vehhp" ) | ||
+ | { | ||
+ | if ( pPlayer.Vehicle ) MessagePlayer( "Your vehicle health is " + pPlayer.Vehicle.Health, pPlayer ); | ||
+ | } | ||
+ | |||
+ | return 1; | ||
+ | } | ||
</code> | </code> | ||
=== Notes === | === Notes === | ||
− | + | The function [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] were used in this example. More info about them in the corresponding pages. | |
== Example 2. Setting == | == Example 2. Setting == |
Revision as of 17:05, 29 September 2010
This Vehicle class member returns or sets the vehicle engine health. Note that max. vehicle health is 1000.0.
Syntax
You can either return or set a new value using this member:
float Vehicle.Health
Vehicle.Health = float health
Arguments
- health - The new engine health of the vehicle
Example 1. Returning
function onPlayerCommand( pPlayer, szCommand, szText ) { if ( szCommand == "vehhp" ) { if ( pPlayer.Vehicle ) MessagePlayer( "Your vehicle health is " + pPlayer.Vehicle.Health, pPlayer ); } return 1; }
Notes
The function MessagePlayer and event onPlayerCommand were used in this example. More info about them in the corresponding pages.
Example 2. Setting
-- Example explanation here
This function needs an example. You can help us complete the wiki by writing one, or maybe even more :o
-- todo
Notes
--Example notes and used functions here.
Related Functions
- CreateVehicle
- FindVehicle
- GetClosestVehicle
- GetVehicleCount
- GetVehicleHandlingData
- GetVehicleIDFromName
- GetVehicleName
- SetVehicleHandlingData
- Vehicle.Alpha
- Vehicle.Angle
- Vehicle.Colour1
- Vehicle.Colour2
- Vehicle.Driver
- Vehicle.EngineDamage
- Vehicle.Explode
- Vehicle.Fix
- Vehicle.GetAddon
- Vehicle.GetPassenger
- Vehicle.GetHandlingData
- Vehicle.GetWheelStatus
- Vehicle.Health
- Vehicle.ID
- Vehicle.IdleRespawnTime
- Vehicle.IdleTime
- Vehicle.LightState
- Vehicle.Locked
- Vehicle.Marker
- Vehicle.MarkerScale
- Vehicle.MarkerSprite
- Vehicle.Model
- Vehicle.OneTime
- Vehicle.PassengerCount
- Vehicle.Pos
- Vehicle.Remove
- Vehicle.Respawn
- Vehicle.RespawnTime
- Vehicle.RGBColour1
- Vehicle.RGBColour2
- Vehicle.SetHandlingData
- Vehicle.SetWheelStatus
- Vehicle.SpawnAngle
- Vehicle.SpawnPos
- Vehicle.SetAddon
- Vehicle.SetEngineState
- Vehicle.SetRadio
- Vehicle.Siren
- Vehicle.SirenLight
- Vehicle.TaxiLight
- Vehicle.Velocity
- Vehicle.VirtualWorld
- Vehicle.Wrecked