SA-MP Forums Archive
Tips for "anti-vehicleID-bug" ? - 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: Tips for "anti-vehicleID-bug" ? (/showthread.php?tid=519929)



Tips for "anti-vehicleID-bug" ? - nGen.SoNNy - 16.06.2014

Hello guys, i started this topic asking for some tips.. i'm using a personal vehicle system.. /car /v commands etc and i wanna know how to prevent the "vehicle ID bugs" cuz sometime players who need to spawn their personal vehicle will get another one and so on


Re: Tips for "anti-vehicleID-bug" ? - RenovanZ - 16.06.2014

Make a variable that hold the player vehicle id.


Re: Tips for "anti-vehicleID-bug" ? - nGen.SoNNy - 16.06.2014

It's already stored... SetVehiclePos( PlayerInfo[ playerid ][ p_VehID ], X, Y, Z );
I mean...sometime i don't get the right vehicle for the right player...


Re: Tips for "anti-vehicleID-bug" ? - Konstantinos - 16.06.2014

Let's say you spawn a vehicle and its vehicle ID is 5. You store that value to the variable and the vehicle gets destroyed. Another player (B) spawns a vehicle and its vehicle ID is 5 and it's stored to the variable. You try to set the vehicle's position but it sets the position for the other player (B).

Solution: Reset the variable when a vehicle is destroyed to INVALID_VEHICLE_ID.


Re: Tips for "anti-vehicleID-bug" ? - Abagail - 16.06.2014

[Deleted Post - Someone else already beat me to it]


Re: Tips for "anti-vehicleID-bug" ? - nGen.SoNNy - 16.06.2014

When i create the Personal Vehicle: PlayerInfo[ playerid ][ p_VehID ] = AddStaticVehicleEx( PlayerInfo[ playerid ][ CarID ],...etc. So when i use CarDeleter( PlayerInfo[ playerid ][ p_VehID ] ); i should make that var PlayerInfo[ playerid ][ p_VehID ] = INVALID_VEHICLE_ID ?


Re: Tips for "anti-vehicleID-bug" ? - IstuntmanI - 20.07.2014

Yes, you should. Do that for all vehicles stored in a variable.