How to destroy another vehicle after spawning a new one? [+1 Rep]
#1

title says it all, how can i do that?
Reply
#2

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.
Reply
#3

show me an example
Reply
#4

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;
}
Reply
#5

No need to put '= 0' in the declaration - variables are always initialized to 0 in pawn.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)