KAKAN

Vehicle Respawn timer

May 5th, 2016
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.55 KB | None | 0 0
  1. function SetAllVehicleRespawnTime( time )
  2. {
  3.     if( typeof(time) != "integer" ) //Check if the time is a integer or not
  4.     {
  5.         throw "Expected: Integer. Got: " + typeof(time); //The process
  6.     }
  7.  
  8.     time = time*1000;
  9.     local a = GetVehicleCount();
  10.     for( local veh, i = 1; i <= a; i++ ) //Loop through all the vehicles.
  11.     {
  12.         veh = FindVehicle( i ); //The vehicle instance.
  13.         if( veh != null ) //Check if the vehicle exists.
  14.         {
  15.             veh.RespawnTimer = time; //Done!
  16.         }
  17.     }
  18. }
  19.  
  20. function onServerStart()
  21. {
  22.     SetAllVehicleRespawnTime( 60 ); //Time in seconds. 
  23. }
Add Comment
Please, Sign In to add comment