Squirrel/Server/Functions/Vehicles/RespawnTime
From Liberty Unleashed Wiki
(Difference between revisions)
(Created page with '{{Squirrel/Title|Vehicle.RespawnTime}} __NOTOC__ This ''Vehicle'' class member returns or sets the respawn time of the given vehicle. == Syntax == You can either return or set a…') |
|||
Line 12: | Line 12: | ||
* '''iRespawnTime''' - This is the new respawn time for the vehicle as a Integer in '''milliseconds'''. | * '''iRespawnTime''' - This is the new respawn time for the vehicle as a Integer in '''milliseconds'''. | ||
− | == Example == | + | == Example 1. Returning == |
− | + | This will returning the found vehicle's respawn time when '/rtime' is typed. | |
− | + | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | - | + | function onPlayerCommand( pPlayer, szCommand, szText ) |
+ | { | ||
+ | if ( szCommand == "rtime" ) | ||
+ | { | ||
+ | local pVehicle = FindVehicle( 0 ); | ||
+ | if ( pVehicle ) | ||
+ | { | ||
+ | MessagePlayer( "Vehicle ID 0's respawn time - " + pVehicle.RespawnTime, pPlayer ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return 1; | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | == Example 2. Setting == | ||
+ | |||
+ | This will set the found vehicle's respawn time to 10 seconds. | ||
+ | |||
+ | <code lang="squirrel"> | ||
+ | function onPlayerCommand( pPlayer, szCommand, szText ) | ||
+ | { | ||
+ | if ( szCommand == "model" ) | ||
+ | { | ||
+ | local pVehicle = FindVehicle( 0 ); | ||
+ | if ( pVehicle ) | ||
+ | { | ||
+ | pVehicle.RespawnTime = 10; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return 1; | ||
+ | } | ||
</code> | </code> | ||
=== Notes === | === Notes === | ||
− | + | The functions [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and [[Squirrel/Server/Functions/Vehicles/FindVehicle|FindVehicle]] and event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] were used in these examples. More info about them in the corresponding pages. | |
Revision as of 17:43, 25 October 2010
This Vehicle class member returns or sets the respawn time of the given vehicle.
Syntax
You can either return or set a new value using this member:
Integer vehicle.RespawnTime
vehicle.RespawnTime = integer iRespawnTime
Arguments
- iRespawnTime - This is the new respawn time for the vehicle as a Integer in milliseconds.
Example 1. Returning
This will returning the found vehicle's respawn time when '/rtime' is typed.
function onPlayerCommand( pPlayer, szCommand, szText ) { if ( szCommand == "rtime" ) { local pVehicle = FindVehicle( 0 ); if ( pVehicle ) { MessagePlayer( "Vehicle ID 0's respawn time - " + pVehicle.RespawnTime, pPlayer ); } } return 1; }
Example 2. Setting
This will set the found vehicle's respawn time to 10 seconds.
function onPlayerCommand( pPlayer, szCommand, szText ) { if ( szCommand == "model" ) { local pVehicle = FindVehicle( 0 ); if ( pVehicle ) { pVehicle.RespawnTime = 10; } } return 1; }
Notes
The functions MessagePlayer and FindVehicle and event onPlayerCommand were used in these examples. More info about them in the corresponding pages.
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