Squirrel/Server/Functions/Vehicles/RespawnTime

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
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 == "model" )
+
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

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


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:

  1. Integer vehicle.RespawnTime
  1. 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.

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "rtime" )
  5. {
  6. local pVehicle = FindVehicle( 0 );
  7. if ( pVehicle )
  8. {
  9. MessagePlayer( "Vehicle ID 0's respawn time - " + pVehicle.RespawnTime, pPlayer );
  10. }
  11. }
  12. return 1;
  13. }
  14.  

[edit] Example 2. Setting

This will set the found vehicle's respawn time to 10 seconds when a player types '/rtime2'.

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "rtime2" )
  5. {
  6. local pVehicle = FindVehicle( 0 );
  7. if ( pVehicle )
  8. {
  9. pVehicle.RespawnTime = 10;
  10. }
  11. }
  12. return 1;
  13. }
  14.  

[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

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox