Squirrel/Server/Functions/Vehicles/RespawnTime
From Liberty Unleashed Wiki
(Difference between revisions)
m (Forgot to change the command name) |
|||
Line 34: | Line 34: | ||
== Example 2. Setting == | == Example 2. Setting == | ||
− | This will set the found vehicle's respawn time to 10 seconds. | + | This will set the found vehicle's respawn time to 10 seconds when a player types '/rtime2'. |
<code lang="squirrel"> | <code lang="squirrel"> | ||
function onPlayerCommand( pPlayer, szCommand, szText ) | function onPlayerCommand( pPlayer, szCommand, szText ) | ||
{ | { | ||
− | if ( szCommand == " | + | if ( szCommand == "rtime2" ) |
{ | { | ||
local pVehicle = FindVehicle( 0 ); | local pVehicle = FindVehicle( 0 ); | ||
Line 55: | Line 55: | ||
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. | 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. | ||
− | |||
== Related Functions == | == Related Functions == | ||
{{Squirrel/Server/Functions/Vehicles}} | {{Squirrel/Server/Functions/Vehicles}} |
Latest revision as of 17:44, 25 October 2010
This Vehicle class member returns or sets the respawn time of the given vehicle.
[edit] Syntax
You can either return or set a new value using this member:
Integer vehicle.RespawnTime
vehicle.RespawnTime = integer iRespawnTime
[edit] Arguments
- iRespawnTime - This is the new respawn time for the vehicle as a Integer in milliseconds.
[edit] 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; }
[edit] Example 2. Setting
This will set the found vehicle's respawn time to 10 seconds when a player types '/rtime2'.
function onPlayerCommand( pPlayer, szCommand, szText ) { if ( szCommand == "rtime2" ) { local pVehicle = FindVehicle( 0 ); if ( pVehicle ) { pVehicle.RespawnTime = 10; } } return 1; }
[edit] Notes
The functions MessagePlayer and FindVehicle and event onPlayerCommand were used in these examples. More info about them in the corresponding pages.
[edit] 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