vehicle id's messup
#1

hee all,

i have a huge problem in my script, what involves the vehicle id's of my housecars
i create them like this:
cInfo[houseid][HouseCar] = CreateVehicle(cInfo[houseid][CarModel], Carx, Cary, Carz, Angx, cInfo[houseid][CarColor1], cInfo[houseid][CarColor2], 120);

and destroy them like this:

DestroyVehicle(cInfo[houseid][HouseCar]);
cInfo[houseid][HouseCar] = 0;

when the server starts everything works out fine, but after a while some of them get mixed up.

since i only allowed the owner of the car to drive it, the car gets unusable.

i really don't know why this happens, anyone have an idea?

i'm really sure that everywhere i destroy the vehicle i define it to 0 like i showed above!

Thanks in advance,

Jop9888
Reply
#2

It sounds like you are creating vehicles and destroying them causing a mix in the IDs.

For instance,
Player A spawns their housecar - Car A
Player B spawns their housecar - Car B
Player A despawns their housecar - Car A's previous ID is now unused
Player C spawns their housecar - Car C, taking the now available ID of Car A.
Reply
#3

yes, that is the way is it supposed to go, carA when recreated will take a new ID who is available, i ques it might be somewhere else in my script where i destroy other vehicles that i might forget to redefine to 0, i will keep on trying
Reply
#4

FIXED! for others with this problem, note that everywere in your script where you destroy a vehicle, you define it to zero

either don't forget to destroy a vehicle when you should, so you won't create it twice!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)