Alright heres my way of doing this i dont know if you have any knowledge of scripting but ill explain it to you anyway.
first of all : above public OnGameModeInit you do;
pawn Код:
new boelieVehicles[MAX_VEHICLES];
new boelieObjects[MAX_OBJECTS];
this makes the objects and vehicles to a variable that can be used to make your own function.
How can you make your own function ?
something called 'stock' can do the trick.
for the vehicles do this;
pawn Код:
stock AddStaticVehicleValue(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:angle, color1, color2)
{
new vehicleID = AddStaticVehicle(modelid, spawn_x, spawn_y, spawn_z, angle, color1, color2);
BoelieVehicles[vehicleID] = 1;
return vehicleID;
}
Notice the 'BoelieVehicles' you added earlyer? you now made your own 'AddStaticVehicle' BUT with a special ingrediлnt. A new variable..
Doing this with Objects is just the same;
pawn Код:
stock CreateValuedObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ,Float:DrawDistance=0.0)
{
new CDMid = CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ,DrawDistance);
BoelieObjects[CDMid] = 1;
return CDMid;
}
I always place the stocks underneath my script. Whatever you do dont put in in a 'callback' ( the parts between public blablabla and return 1;
Now Replace all 'AddStaticVehicle' in your script with AddStaticVehicleValue
if you have CreateVehicle in your script then replace it also with AddStaticVehicleValue
With CreateObject you do the same; Replace the name CreateObject with CreateValuedObject
Now its time to make a function that destroys both Objects and Vehicles at the same time
so here comes the stock again;
pawn Код:
stock DestroyAllBoelie()
{
for(new o=0;o<MAX_OBJECTS; o++)for(new v=0;v<MAX_VEHICLES; v++)
{
if(BoelieObjects[o] ==1)
{
DestroyObject(o);
}
if(BoelieVehicles[v] == 1)
{
DestroyVehicle(v);
}
}
}
There...if you want it all to be just respawned than just replace destroyvehicle with SetVehicleToRespawn.
Now add this function
anywhere you want . It should destroy all objects and vehicles if you done correctly.