Hi. I need help making a command that destroys all vehicles spawned with a command - 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: Hi. I need help making a command that destroys all vehicles spawned with a command (
/showthread.php?tid=489763)
Hi. I need help making a command that destroys all vehicles spawned with a command -
MoeSal - 24.01.2014
Hi i was looking to make a command that destroys all vehicles spawned with a command. Because sometimes players might just start to have fun spawning random cars than have a pile of cars sitting somewhere blocking the roads and etc.
Re: Hi. I need help making a command that destroys all vehicles spawned with a command -
Don_Cage - 24.01.2014
Can you show the command you use to spawn vehicles?
Re: Hi. I need help making a command that destroys all vehicles spawned with a command -
Shetch - 24.01.2014
Create a variable that stores all the spawned vehicles.
Код:
new spawned_vehicles[MAX_PLAYERS][MAX_VEHICLES];
Once you spawn a vehicle, assign it's id to the variable.
Код:
spawned_vehicles[playerid][vehicleid] = 1; // '1' means that the vehicle is spawned.
When you want to destroy all player's spawned vehicles, use:
Код:
for(new i = 0; i < MAX_VEHICLES; i++)
{
if(spawned_vehicles[playerid][i] == 1)
{
DestroyVehicle(i);
spawned_vehicles[playerid][i] = 0;
}
}
Re: Hi. I need help making a command that destroys all vehicles spawned with a command -
Don_Cage - 24.01.2014
Quote:
Originally Posted by Shetch
Create a variable that stores all the spawned vehicles.
Код:
new spawned_vehicles[MAX_PLAYERS][MAX_VEHICLES];
Once you spawn a vehicle, assign it's id to the variable.
Код:
spawned_vehicles[playerid][vehicleid] = 1; // '1' means that the vehicle is spawned.
When you want to destroy all player's spawned vehicles, use:
Код:
for(new i = 0; i < MAX_VEHICLES; i++)
{
if(spawned_vehicles[playerid][i] == 1)
{
DestroyVehicle(i);
spawned_vehicles[playerid][i] = 0;
}
}
|
That will destroy the vehicles that the playerid have spawned