Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: VK.Jona83Killer on Aug 10, 2017, 04:09 AM

Title: I need the command to respawn all vehicles
Post by: VK.Jona83Killer on Aug 10, 2017, 04:09 AM
On my server, several users leave the cars launched, could someone give me the command to respawn all vehicles? ;D
Title: Re: I need the command to respawn all vehicles
Post by: KAKAN on Aug 10, 2017, 08:42 AM
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 )
Title: Re: I need the command to respawn all vehicles
Post by: VK.Jona83Killer on Aug 10, 2017, 03:01 PM
Thanks Bro :)