Destroy Vehicle Problem
#1

hi guys
i have a lil Problem:
i'm using a Vehicle Spawner(FS)
and i want the Vehicle to disappear when i leave it
But the Problem is that i have another Cars in the Real GameMode and i dont want them to disappear like the "spawner cars"
anobody got an idea
Thx Guys
Reply
#2

pawn Код:
// In Spawner FS (TOP)
new IsASpawnedCar[MAX_VEHICLES];

// When the vehicle is created (Spawner FS)
IsASpawnedCar[vehicleid] = 1;

 // Wherever is destroys when you leave
// (Remove the other DestroyVehicle)
if(IsASpawnedCar[vehicleid])
{
    DestroyVehicle(vehicleid);
}
Reply
#3

thx
but where should i add :
IsASpawnedCar[vehicleid] = 1; ??> under what?
---------------
and : if(IsASpawnedCar[vehicleid])
{
DestroyVehicle(vehicleid);
}

under public OnPlayerExitVehicle(playerid, vehicleid) ??
Thx
Reply
#4

yes, Mike already told you everything you need:
new IsASpawnedCar[MAX_VEHICLES]; belongs into the cars-filterscript. this array is only known to this car-filterscript, despite that its sharing all vehicle ids with the gamemode indeed. as soon the filterscript creates a car (CreateVehicle), let it set the
Код:
//your CreateVehicle(blablablab);
variable IsASpawnedCar[vehicleid] = 1;
...just add that line below your CreateVehicle() line, so the filterscript will know that that car got spawned by itself.
in your OnPlayerExitVehicle(playerid,vehicleid) callback, add the check if the car, is one of the filterscripts spawned cars. the gamemode wont see the "set to 1" variable, so that check
Код:
if(IsASpawnedCar[vehicleid])
{
//your DestroyVehicle(vehicleid);
}
will return 0 for any gamemode created cars. it will return 1 in the filterscripts cars, so you can destroy it then.
ah, maybe you need to GetPlayerVehicleID(playerid) first, but i presume you already know that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)