KAKAN

Delete vehicle from a world.

Jul 6th, 2016
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.60 KB | None | 0 0
  1. function DelVeh( world )
  2. {
  3.     local to = typeof(world), vehCount = GetVehicleCount();
  4.     //See if the world is a integer or not.
  5.     if( to != "integer" ) throw "Expected (int), got ("+to+")";
  6.     //loop through all the vehicles
  7.     for(local veh, i = 0; i < vehCount; i++ ){
  8.         //Get the instance of the vehicle.
  9.         veh = FindVehicle(i);
  10.         //See if the vehicle exists and it's world is same as the parameter.
  11.         if( veh && veh.World == world ){
  12.             //Uncomment this if you don't want your console spammed :P
  13.             print("Deleting vehicle number " + veh.ID );
  14.             //And finally, delete the vehicle
  15.             veh.Delete();
  16.         }
  17.     }
  18. }
Add Comment
Please, Sign In to add comment