How to destroy another vehicle after spawning a new one? [+1 Rep] - 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: How to destroy another vehicle after spawning a new one? [+1 Rep] (
/showthread.php?tid=330670)
How to destroy another vehicle after spawning a new one? [+1 Rep] -
newbienoob - 02.04.2012
title says it all, how can i do that?
Re: How to destroy another vehicle after spawning a new one? [+1 Rep] -
MP2 - 02.04.2012
You mean when players spawn vehicles? Store the ID of the vehicle that was spawned in an array for the playerid, then next time they spawn a vehicle use DestroyVehicle() before you re-set the ID.
Re: How to destroy another vehicle after spawning a new one? [+1 Rep] -
newbienoob - 02.04.2012
show me an example
Re: How to destroy another vehicle after spawning a new one? [+1 Rep] -
[ABK]Antonio - 02.04.2012
Here's an example
pawn Code:
new Car[MAX_PLAYERS] = 0;
CMD:car(playerid, params[])
{
if(Car[playerid] != 0) DestroyVehicle(Car[playerid]); //destroy it, then we continue down the script
Car[playerid] = CreateVehicle(blah blah blah);
return 1;
}
Re: How to destroy another vehicle after spawning a new one? [+1 Rep] -
MP2 - 02.04.2012
No need to put '= 0' in the declaration - variables are always initialized to 0 in pawn.