Squirrel/Server/Functions/Vehicles/RespawnTime

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(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 ==
  
{{Squirrel/NeedsExample}}
+
This will returning the found vehicle's respawn time when '/rtime' is typed.
Explanation for the example
+
  
 
<code lang="squirrel">
 
<code lang="squirrel">
-- Todo
+
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 ===
  
-- List of used functions and other notes here.  
+
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

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.

Syntax

You can either return or set a new value using this member:

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

  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.  

Example 2. Setting

This will set the found vehicle's respawn time to 10 seconds.

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

Notes

The functions MessagePlayer and FindVehicle and event onPlayerCommand were used in these examples. More info about them in the corresponding pages.


Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox