Vehicle loading problem
#1

The problem I think is simple, the system loads too many vehicles. It loads 30 vehicles instead of like 3

pawn Код:
public OnVehicleLoad()
{
    new rows, fields;
    cache_get_data(rows, fields, mysql);
    if(rows)
    {
        for(new i = 0; i < rows && i < MAX_VEHICLES; i++){
            for(new x = 0; x < MAX_LOADED_CARS;x++) {
                VehInfo[i][VehMasterID] = cache_get_field_content_int(i,"MasterID");
                VehInfo[i][VID] = cache_get_field_content_int(i,"ID");
                VehInfo[i][ModelID] = cache_get_field_content_int(i,"ModelID");
                VehInfo[i][Color1] = cache_get_field_content_int(i,"Color1");
                VehInfo[i][Color2] = cache_get_field_content_int(i,"Color2");
                VehInfo[i][VehPosX] = cache_get_field_content_float(i,"PosX");
                VehInfo[i][VehPosY] = cache_get_field_content_float(i,"PosY");
                VehInfo[i][VehPosZ] = cache_get_field_content_float(i,"PosZ");
                VehInfo[i][VehPosA] = cache_get_field_content_float(i,"PosA");
                VehInfo[i][VRespawnTime] = cache_get_field_content_int(i,"RespawnTime");
                VehInfo[i][VPrice] = cache_get_field_content_int(i,"Price");
                VehInfo[i][DamageStatus] = cache_get_field_content_float(i,"Damage");
                VehInfo[i][FuelStatus] = cache_get_field_content_int(i,"FuelStatus");
                VehInfo[i][EngineStatus] = cache_get_field_content_int(i,"EngineStatus");
                VehInfo[i][Kilometrage] = cache_get_field_content_float(i,"Kilometrage");
                VehInfo[i][vSiren] = cache_get_field_content_int(i,"Siren");
                VehInfo[i][vOwned] = cache_get_field_content_int(i,"Owned");
                VehInfo[i][VehWorld] = cache_get_field_content_int(i,"VirtualWorld");
                VehInfo[i][VehInterior] = cache_get_field_content_int(i,"Interior");
                VehInfo[i][vCreated][x] = CreateServerVehicle(VehInfo[i][ModelID],VehInfo[i][VehPosX],VehInfo[i][VehPosY],VehInfo[i][VehPosZ],VehInfo[i][VehPosA],VehInfo[i][Color1],VehInfo[i][Color2],VehInfo[i][VRespawnTime],VehInfo[i][vSiren]);
                SetVehicleVirtualWorld(VehInfo[i][vCreated][x],VehInfo[i][VehWorld]);
                LinkVehicleToInterior(VehInfo[i][vCreated][x],VehInfo[i][VehInterior]);
                SetVehiclePos(VehInfo[i][vCreated][x],VehInfo[i][VehPosX],VehInfo[i][VehPosY],VehInfo[i][VehPosZ]);
                SetVehicleZAngle(VehInfo[i][vCreated][x],VehInfo[i][VehPosA]);
                VehiclesLoaded++;
            }
        }
        printf("Total %i vehicles spawned",VehiclesLoaded);
    }
    else print("No vehicles to be loaded..");
    return true;
}
pawn Код:
#define MAX_LOADED_CARS 10
enum VINFO
{
    VID,
    VehMasterID,
    ModelID,
    Color1,
    Color2,
    Float:VehPosX,
    Float:VehPosY,
    Float:VehPosZ,
    Float:VehPosA,
    VRespawnTime,
    VPrice,
    Float:DamageStatus,
    FuelStatus,
    EngineStatus,
    Float:Kilometrage,
    vSiren,
    vOwned,
    VehWorld,
    VehInterior,
    vCreated[MAX_LOADED_CARS]
}

What I think the problem is basically
VehInfo[i][vCreated][x]
But im trying to create all vehicles and assign them to some unique ID
Reply


Messages In This Thread
Vehicle loading problem - by TwinkiDaBoss - 25.11.2015, 20:23
Re: Vehicle loading problem - by CmZxC - 25.11.2015, 20:39
Re: Vehicle loading problem - by TwinkiDaBoss - 25.11.2015, 20:47
Re: Vehicle loading problem - by CmZxC - 25.11.2015, 20:54
Re: Vehicle loading problem - by TwinkiDaBoss - 25.11.2015, 20:58
Re: Vehicle loading problem - by Dokins - 26.11.2015, 11:16
Re: Vehicle loading problem - by TwinkiDaBoss - 26.11.2015, 14:25
Re: Vehicle loading problem - by CmZxC - 26.11.2015, 14:47
Re: Vehicle loading problem - by TwinkiDaBoss - 26.11.2015, 14:50
Re: Vehicle loading problem - by CmZxC - 26.11.2015, 14:51

Forum Jump:


Users browsing this thread: 3 Guest(s)