*** Terrible Title Removed
#1

Greetings,

I'm currently experiencing a problem with the script. If a player purchases a vehicle and then if a GMX occurs, the vehicle will turn into thousands of vehicles and will fuck-up the area; mass FPS lag. I hope it's clear now.

I'd appreciate your assistance, thanks in advance.

Here's the code of LoadVehicle:

pawn Код:
stock LoadVehicles()
{
    new file[100];
    new tmp[256];
    new var[18];

    new model;
    new Float:x;
    new Float:y;
    new Float:z;
    new Float:a;
    new vehicleid;
    for (new i = 1; i < MAX_VEHICLES; i += 1)
    {
        format(file, sizeof(file), "DealerInfo/cars/%d.cdat", i);
        if (dini_Exists(file))
        {
            model = dini_Int(file, "veh_model");
            x = dini_Float(file, "veh_x");
            y = dini_Float(file, "veh_y");
            z = dini_Float(file, "veh_z");
            a = dini_Float(file, "veh_rot");
            vehicleid = AddStaticVehicleEx(model, x, y, z, a, 1, 1, -1);

            tmp = dini_Get(file, "veh_plate");
            format(VehicleEnum[vehicleid][veh_plate], MAX_PLATE_LENGTH + 1, tmp);

            tmp = dini_Get(file, "veh_owner");
            format(VehicleEnum[vehicleid][veh_owner], MAX_PLAYER_NAME, tmp);

            VehicleEnum[vehicleid][veh_model] = dini_Int(file, "veh_model");
            VehicleEnum[vehicleid][veh_owned] = dini_Int(file, "veh_owned");
            VehicleEnum[vehicleid][veh_price] = dini_Int(file, "veh_price");
            VehicleEnum[vehicleid][veh_x] = dini_Float(file, "veh_x");
            VehicleEnum[vehicleid][veh_y] = dini_Float(file, "veh_y");
            VehicleEnum[vehicleid][veh_z] = dini_Float(file, "veh_z");
            VehicleEnum[vehicleid][veh_rot] = dini_Float(file, "veh_rot");
            for(new c = 1; c < 18; c++)
            {
                format(var, sizeof(var), "veh_component%d", c);
                VehicleEnum[vehicleid][veh_comp][c] = dini_Int(file, var);
            }
            VehicleEnum[vehicleid][veh_colors][1] = dini_Int(file, "veh_color1");
            VehicleEnum[vehicleid][veh_colors][2] = dini_Int(file, "veh_color2");
            VehicleEnum[vehicleid][veh_paintjob] = dini_Int(file, "veh_paintjob");
            VehicleEnum[vehicleid][veh_locked] = dini_Int(file, "veh_locked");
            VehicleEnum[vehicleid][veh_slot] = dini_Int(file, "veh_slot");
            VehicleEnum[vehicleid][veh_int] = dini_Int(file, "veh_int");
            VehicleEnum[vehicleid][veh_world] = dini_Int(file, "veh_world");
            VehicleEnum[vehicleid][veh_neon] = dini_Int(file, "veh_neon");
            VehicleEnum[vehicleid][veh_impounded] = dini_Int(file, "veh_impounded");
            VehicleEnum[vehicleid][veh_impoundprice] = dini_Int(file, "veh_impoundprice");
            VehicleEnum[vehicleid][veh_haslock] = dini_Int(file, "veh_haslock");
            VehicleEnum[vehicleid][veh_registerdate][1] = dini_Int(file, "veh_registerdate1");
            VehicleEnum[vehicleid][veh_registerdate][2] = dini_Int(file, "veh_registerdate2");
            VehicleEnum[vehicleid][veh_registerdate][3] = dini_Int(file, "veh_registerdate3");
            VehicleEnum[vehicleid][veh_registerdate][4] = dini_Int(file, "veh_registerdate4");
            VehicleEnum[vehicleid][veh_registerdate][5] = dini_Int(file, "veh_registerdate5");
            VehicleEnum[vehicleid][veh_registerdate][6] = dini_Int(file, "veh_registerdate6");
            NeonActivated[vehicleid] = dini_Int(file, "NeonActivated");
            VehicleEnum[vehicleid][veh_trunkgun1] = dini_Int(file, "veh_trunkgun1");
            VehicleEnum[vehicleid][veh_trunkgun2] = dini_Int(file, "veh_trunkgun2");
            VehicleEnum[vehicleid][veh_trunkgun3] = dini_Int(file, "veh_trunkgun3");
            VehicleEnum[vehicleid][veh_trunkgun4] = dini_Int(file, "veh_trunkgun4");
            VehicleEnum[vehicleid][veh_trunkarmor] = dini_Float(file, "veh_trunkarmor");
            VehicleEnum[vehicleid][veh_trunkcocaine] = dini_Int(file, "veh_trunkcocaine");
            VehicleEnum[vehicleid][veh_trunkweed] = dini_Int(file, "veh_trunkweed");
            VehicleEnum[vehicleid][veh_trunkmeth] = dini_Int(file, "veh_trunkmeth");
            VehicleEnum[vehicleid][veh_trunkheroin] = dini_Int(file, "veh_trunkheroin");
            VehicleEnum[vehicleid][veh_trunkmats] = dini_Int(file, "veh_trunkmats");
            VehicleEnum[vehicleid][veh_trunkcash] = dini_Int(file, "veh_trunkcash");
            //ModifyVehicle(vehicleid);
            LinkVehicleToInterior(vehicleid, VehicleEnum[vehicleid][veh_int]);
            SetVehicleVirtualWorld(vehicleid, VehicleEnum[vehicleid][veh_world]);
            if(VehicleEnum[vehicleid][veh_locked]) LockVehicle(vehicleid);
            if (NeonActivated[vehicleid])
            {
                AddNeonToVehicle(-1, vehicleid, VehicleEnum[vehicleid][veh_neon]);
            }
            if(vehicleid != INVALID_VEHICLE_ID) ownedcars++;
            if (IsABicycle(vehicleid) || IsATrain(vehicleid) || IsVehicleRCVehicle(vehicleid)) SetVehicleEngine(vehicleid, 1);
            else SetVehicleEngine(vehicleid, 0);

            //fremove(file);
            SaveVehicle(vehicleid);
        }
    }
    return 1;
}
Reply
#2

I've faced that proplem too, But couln't fix it.
Reply
#3

Anyone?
Reply
#4

well you can try doing so, but no promises:

make a global variable called
pawn Код:
new vSpawned[MAX_VEHICLES];
to the end of your LoadVehicles() loop make
pawn Код:
vSpawned[i] = 1;
and in the very beginning of the loop, before the format, add
pawn Код:
if(vSpawned[i]) continue;
This is completely untested, so there are no promises from me, this is just a suggestion.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)