SA-MP Forums Archive
Car Loading bug help - 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: Car Loading bug help (/showthread.php?tid=559583)



Car Loading bug help - MrSwindle - 24.01.2015

I have a car system and that should save the cars location when the script closes and it does save. Although upon opening the script It doesnt load at the correct coordinates. The cars load at 0,0,0.

*Here is the Load Vehicle stock."
pawn Код:
stock LoadVehicles()
{
    new string[80], file[64], engine, lights, alarm, doors, bonnet, boot, objective, corrCount;

    print("=-=-=-=-=-=-=-=-=-=-=-=-=");
    print("\n  Loading Vehicles: \n");

    for(new v; v < MAX_VEHICLES; v ++)
    {
        GetVehicleParamsEx(v, engine, lights, alarm, doors, bonnet, boot, objective);

        format(file, sizeof(file), "Vehicles/%d.ini", v);

        if(fexist(file))
        {
            INI_ParseFile(VehiclePath(v), "LoadVehicleData", false, true, v, true, false);

            format(string, sizeof(string), "SA %d", vInfo[v][Plate]);
            SetVehicleNumberPlate(v, string);

            SetVehicleToRespawn(v); // respawning so the license plate shows
            SetVehicleParamsEx(v, 0, lights, alarm, 1, bonnet, boot, objective);

            vEngine[v] = false;
            vLocked[v] = true;

            format(string, sizeof(string), "  Loaded vehicle ID: %d at %f %f %f", v, vInfo[v][xPos], vInfo[v][yPos], vInfo[v][zPos]);
            CreateVehicle(vInfo[v][Model], vInfo[v][xPos], vInfo[v][yPos], vInfo[v][zPos], vInfo[v][aPos], vInfo[v][ColorA], vInfo[v][ColorB], -1);

            print(string);
            vCount ++;
        }
    }

    // Since vCount requires ID 1 to function properly, we don't actually load "1" vehicle.
    corrCount = vCount - 1; // This fixes the +1 bug and shouldn't be removed.

    printf("\n  %d vehicles loaded!", corrCount);
    print("=-=-=-=-=-=-=-=-=-=-=-=-=");

    return true;
}
*Here is the Main*
pawn Код:
main()
{
    print("\n=-=-=-=-=-=-=-=-=-=-=-=-=");
    print("=-=  Loading systems  =-=");
    print("=-=-=-=-=-=-=-=-=-=-=-=-=\n");
   
    LoadVehicles();
   
    print("\n=-=-=-=-=-=-=-=-=-=-=-=-=");
    print("=-= Loading finished! =-=");
    print("=-=-=-=-=-=-=-=-=-=-=-=-=\n");
}



Re: Car Loading bug help - MrSwindle - 24.01.2015

bump


Re: Car Loading bug help - MrSwindle - 25.01.2015

Bump again. Does anyone know what to do? Or what causes this