AddStaticVehicleEx ID's problem - 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: AddStaticVehicleEx ID's problem (
/showthread.php?tid=354979)
AddStaticVehicleEx ID's problem -
Makaveli93 - 28.06.2012
For some reason, when a vehicle is destroyed and then re-spawned, or just re-spawned, the vehicle ids tend to mix up and variables that store those IDs now have a different ID. For example:
pawn Код:
new TaxiCar;
OnGameModeInit
{
  TaxiCar = AddStaticVehicleEx(taxi car info and spawn info...");
}
Now, I have a check on OnPlayerStateChage, for player entering a taxi car as a passenger, which starts the timer for taxi ride cost. After the car is re-spawned by GTA or destroyed and then re-spawned, TaxiCar variable gets a different ID and the original taxi car has also a different ID. This happens with police and other vehicles, such as private, faction or admin vehicles. Is there a way to fix this somehow? I don't set/reset any variables on OnVehicleDeath or on OnVehicleSpawn, it's basically empty.
Re: AddStaticVehicleEx ID's problem -
RedWingz - 28.06.2012
Maybe this;
pawn Код:
new TaxiCar;
OnGameModeInit
{
  TaxiCar = AddStaticVehicleEx(taxi car info and spawn info...); (REMOVED Speech Marks)
}
Never really tried that type of code.
So don't guarantee that it will work. :/
If not, then good luck!