/v removes last spawned vehicle
#2

Instead of defining "car" variable for each menu item, define it globally that way:

pawn Код:
new car[MAX_PLAYERS];
then each time a vehicle is being spawned the current gets destroyed like that..

pawn Код:
DestroyVehicle(car[playerid]);
So it be finally like that..

pawn Код:
// Anywhere after the includes..
new car[MAX_PLAYERS];

// An example of responding to a menu-item..
case 0: //go kart
{
            new Float:x, Float:y, Float:z, Float:a;
            GetPlayerFacingAngle(playerid,a);
            GetPlayerPos(playerid, x, y, z);
            if(car[playerid] != INVALID_VEHICLE_ID) DestroyVehicle(car[playerid]);
            car[playerid] = CreateVehicle(571,x,y,z+4,a,-1,-1,30000);
            PutPlayerInVehicle(playerid,car,0);
            SendClientMessage(playerid, 0xFFFFFFFF, "Je selecteerde een Go Kart");
 
}
Reply


Messages In This Thread
/v removes last spawned vehicle - by nickbouwhuis - 15.10.2012, 15:39
Re: /v removes last spawned vehicle - by Randy More - 15.10.2012, 16:05
Re: /v removes last spawned vehicle - by nickbouwhuis - 15.10.2012, 16:48
Re: /v removes last spawned vehicle - by nickbouwhuis - 16.10.2012, 15:34
Re: /v removes last spawned vehicle - by nickbouwhuis - 17.10.2012, 06:43
Re : /v removes last spawned vehicle - by Ataraxia - 17.10.2012, 10:42
Re: Re : /v removes last spawned vehicle - by nickbouwhuis - 17.10.2012, 13:05
Re : /v removes last spawned vehicle - by Ataraxia - 17.10.2012, 15:58
Re: Re : /v removes last spawned vehicle - by nickbouwhuis - 17.10.2012, 17:03

Forum Jump:


Users browsing this thread: 1 Guest(s)