SA-MP Forums Archive
Destroy cars once they have exploded? - 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: Destroy cars once they have exploded? (/showthread.php?tid=403115)



Destroy cars once they have exploded? - MrSnapp - 29.12.2012

HI there. I am using a filterscript for a car spawn menu but once they have exploded or drowned they go back to the place the car menu spawned them from. How do I make it that cars ONLY spawned from this filterscript car menu not respawn?

Thanks


Re: Destroy cars once they have exploded? - Joe Staff - 29.12.2012

To state it obviously, use DestroyVehicle under OnVehicleDeath...


Re: Destroy cars once they have exploded? - MrSnapp - 29.12.2012

I'm sorry for being noobish but could you help me one last time with adding that to this command as I am sure just adding that statement of DestroyVehicle would not work:
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
     for(new i = 0; i < MAX_PLAYERS; i++)
     {
          if(GetPlayerVehicleID(i) == vehicleid) RemovePlayerFromVehicle(i);
     }
     return 1;
}



Re: Destroy cars once they have exploded? - Storm94 - 29.12.2012

If you only want the cars that the FS spawns to be destroyed when they touch water, then it is a bit more complicated. You would have to keep track of which vehicle IDs are spawned by that FS, and then in OnVehicleDeath, check if the vehicle "dying" is one of those, and if so, DestroyVehicle.


Re: Destroy cars once they have exploded? - MrSnapp - 29.12.2012

Nevermind. GOT IT ALL WORKING. YOU CAN DELETE THIS THREAD!