View Full Version : Complicated Issue (Owned Car removal dini problem)

24/01/2013, 10:15 PM
In my GM, when it remove an owned car (via admin selling, crushing it, or normal selling it) it removes the Vehicle file in the dini folder (EX: 13.ini).

The problem is is that in the GM everything in the script uses GetPlayerVehicleID, so removing a car thats loaded, messes everything up (all the vehicle profiles will be off by one).

Example: When I sell Vehicle 13 (In the vehicle profiles it's 13.ini and in user profiles it's Car1=13) it removes the vehicle profile (13.ini) and sets Car1=0 in the user profile... So when the GM next updates there will be no more Vehicle 13, however if there's a Vehicle 14 (In the vehicle profiles it's 14.ini and in user profiles it's Car4), that car would be loaded as Vehicle 13 according to GetPlayerVehicleID as there is no longer a Vehicle 13... But in the profile that car should be 14...



*I will Rep for this for those who care, this is a HUGE problem in my server.*

24/01/2013, 10:24 PM
Well, this is a bigger problem than your previous one hehe :)
I could somehow think for a solution or I could just give you my codes for vehicle ownership, mine are 100% secure in saving and loading ( and also uses Dini )
What do you say?

24/01/2013, 10:25 PM
Try this way:

new vehicle[MAX_VEHICLES];

Now use this instead

vehicle[0] = CreateVehicle(...)

Now you should use Vehicle[vehicleid]... this vehicleid could mean the file name.

Now the vehicle should be:

ID 13 or anyother, but the vehicle[id] will be the same.

25/01/2013, 06:47 AM
Or don't use dini if you can avoid it for your application of it. It'd be easier using the native file commands than dini. Checkout the XVM filter script in my sig for an application of what I'm talking about but it would be easier and all cars could be stored in a single file rather than in loads of smaller files. I'd be happy to take a look at what ur doing with ur code and convert it.

I know the exact problem your having and fixed it 7 years ago now by simply rewriting the file save and storage system to something way more flexible.