View Single Post
Old 15/12/2019, 06:55 PM   #4
Big Clucker
CXdur's Avatar
Join Date: Jun 2014
Location: Norway
Posts: 57
Reputation: 6
Default Re: Reload vehicle sql

How come you access the vehicle info array with vInfo[vehicleId]][], but you also have vId? I think you could stick with just the vehicle ID for its inde, and get rid of the vInfo[vid][vID]?
 new vehicleid = GetPlayerVehicleID(playerid);
Also, why are you looping through the max vehicles? I believe the issue is that when the vehicle is spawned, it might get a different vehicle ID from what you've used.
            new vehicle = CreateVehicle(model, x, y, z, a, color1, color2, -1);
                if (vehicle != INVALID_VEHICLE_ID)
                    vInfo[vehicle][vDbId] = id;
                    vInfo[vehicle][vLocked] = false;
                    // set variables
You can apply this to Chargement_Vehicules as well. Only start changing the car data once you have spawned the vehicle, to ensure that you always have the correct vehicle id as your vInfo index.
CXdur is offline   Reply With Quote