[HELP] CreateVehicle cars respawning -
Haegon - 27.11.2010
Hello! I have a admin script where you can spawn cars. Once those cars blow up, they respawn in the same place they were created. I would like to make it so they don't spawn once they are destroyed - they just disappear all together. They are created with CreateVehicle, so they aren't static.
I used DestroyVehicle under OnVehicleRespawn, but it effects the non-admin vehicles as well.
I was wondering if there is another way to do this, or if there is a way to assign the admin vehicles a vehicle-specific name or something that sets it apart from the others, so I can tell DestroyVehicle to destroy ONLY the admin vehicles.
Thanks guys!
- Haegon
Re: [HELP] CreateVehicle cars respawning -
BMUK - 27.11.2010
new admincar = CreateVehicle...
DestroyVehicle(admincar);
Re: [HELP] CreateVehicle cars respawning -
Haegon - 27.11.2010
The only thing with that, is it only deletes the last vehicle created. Is it possible to destroy all of the admin vehicles, or am I missing something? :P
Re: [HELP] CreateVehicle cars respawning -
XoSarahMoX - 27.11.2010
Maybe try putting the destroyvehicle(admincar) in public onvehicledeath
Re: [HELP] CreateVehicle cars respawning -
Haegon - 27.11.2010
That was worth a shot but it didn't work. It successfully destroyed the last one of the 3 I made to test it on, but the other two respawned. =|
Thanks for the try though. =)
Re: [HELP] CreateVehicle cars respawning -
Ash. - 27.11.2010
You need to either create an array to store all of your spawned vehicles - or limit the amount of a vehicles an admin can spawn.
Re: [HELP] CreateVehicle cars respawning -
XoSarahMoX - 27.11.2010
Make a /deleteveh command and make it a admin only command

.
Re: [HELP] CreateVehicle cars respawning -
Haegon - 27.11.2010
I currently have what I might mistakingly be calling an array of cars to control my random car spawns. I'm not sure if I can utilize that for this purpose as well? Here is the code.
Код:
new RandCars[] = {
400,401,404,410,
421,422,426,439,
445,461,466,467,
474,477,479,482, // Here are the random car ID's that are allowed to spawn.
483,489,491,492,
496,500,507,516,
517,518,526,533,
540,542,545,554,
555,559,565,576,
581,600,602,605
};
enum eCars
{
model_id,
Float:pos_x,
Float:pos_y, // The eCars enum.
Float:pos_z,
Float:z_angle,
};
for (new i; i < sizeof CarSpawns; i++) //Random mumbo jumbo of code.
AddStaticVehicleEx( RandCars[random(sizeof RandCars)], CarSpawns[i][pos_x], CarSpawns[i][pos_y], CarSpawns[i][pos_z], CarSpawns[i][z_angle], -1, -1, 100000);
Somewhere inbetween the top two and the last bit of code is all the coordinates for the cars to spawn at.
I'm not sure if this is quite what you were referring to or not, so I figured i'd show off a little code. :P
Re: [HELP] CreateVehicle cars respawning -
Haegon - 27.11.2010
Quote:
Originally Posted by XoSarahMoX
Make a /deleteveh command and make it a admin only command  .
|
Actually, that's what I temporarily have in place now, but it only deletes the one the admin is in. I'm aiming to make it like a sort of cleanup tool and delete all admin vehicles that aren't occupied.
Re: [HELP] CreateVehicle cars respawning -
XoSarahMoX - 27.11.2010
Maybe make it so when the admin does /deleteveh it does
DeleteVehicle(playerid, admincar);
Wouldnt that delete all cars with the admincar variable representing them?

Not sure though :P