I need the command to respawn all vehicles

Started by VK.Jona83Killer, Aug 10, 2017, 04:09 AM

Previous topic - Next topic

VK.Jona83Killer

On my server, several users leave the cars launched, could someone give me the command to respawn all vehicles? ;D

KAKAN

I'll give you two ways.
Copy this function and paste it anywhere:-
function RespawnVehicles( rtime = 0 ){
//Loop over all the vehicles.
for( local veh, i = 1; i <= 1000; i++ ){
veh = FindVehicle(i);
if( !veh ) continue;
if( rtime == 0 ) veh.Respawn();
else veh.RespawnTimer = rtime; //Time in ms.
}
}
1. Command:-
if( cmd == "rveh" ){
RespawnVehicles();
}
That will respawn all vehicles.
And, if you want automatic respawn, i.e, vehicles respawn after a certain time, then pass a time to it.
For ex: RespawnVehicles(60000);This code will make the vehicles respawn themselves every 1 min( 60 seconds )
oh no

VK.Jona83Killer