Tips for "anti-vehicleID-bug" ?
#1

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
Reply
#2

Make a variable that hold the player vehicle id.
Reply
#3

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

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

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

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 ?
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)