SA-MP Forums Archive
Does anyone know how to....... - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Does anyone know how to....... (/showthread.php?tid=250906)



Does anyone know how to....... - Jack_Rocker - 24.04.2011

Can anyone show me how to make a /respawnallcars command (ALSO, they must be unused!)

Thanks


Re: Does anyone know how to....... - sMog. - 25.04.2011

Command:
Quote:

if (strcmp("/respawnallvehicles", cmdtext, true, 10) == 0)
{
for(new cars=0; cars<MAX_VEHICLES; cars++)
{
if(!VehicleOccupied(cars))
{
SetVehicleToRespawn(cars);
RepairVehicle(cars);
}
}
return 1;
}

Somewhere in your gamemode
Quote:

forward VehicleOccupied(vehicleid);
public VehicleOccupied(vehicleid)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInVehicle(i,vehicleid)) return 1;
}
return 0;
}