SA-MP Forums Archive
auto respawn - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: auto respawn (/showthread.php?tid=653553)



auto respawn - nbx2000 - 07.05.2018

Is it possible to return this cmd to be automatically, to respawnall cars automatically every 5 minutes?


CMD:respawnallcars(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 6) {
for(new v=0;v<MAX_VEHICLES;v++) {
if(!IsVehicleOccupied(v))
if(IsValidVehicle(v)) {
if(VehicleInfo[v][Temp] == 0) VehicleInfo[v][respawn] = 1;
EraseVehicle(v);
}
}
return SendClientMessage(playerid,0xFFFFFFAA," All empty cars were respawned !");
} else return SendClientMessage(playerid,COLOR_BRIGHTRED,"ERROR: You need to be administrator level 6 to use this command");
}


Re: auto respawn - Rektumiliam - 07.05.2018

You could use a timer for that, or even better https://sampwiki.blast.hk/wiki/AddStaticVehicleEx


Re: auto respawn - Monotox - 07.05.2018

I think is more simple use the parameter "respawn_delay" in the car declaration.

AddStaticVehicleEx parameters:
Код:
(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2, respawn_delay, addsiren=0)
See more here: https://sampwiki.blast.hk/wiki/AddStaticVehicleEx