2000 cells big array
#4

Then you probably won't need 2000 vehicles I made a quick mock-up to give you an idea of what you will need to do.

pawn Код:
#define         MAX_DYNAMIC_VEHICLES            1000

enum VEHICLEINFO
{
    p_PlayerID,
    p_CarVID,
    p_CarModel,
    Float:p_CarX,
    Float:p_CarY,
    Float:p_CarZ,
    Float:p_CarFA,
}

static VehicleData[MAX_DYNAMIC_VEHICLES][VEHICLEINFO];
static Iterator:DynCars<MAX_DYNAMIC_VEHICLES>;

AddVehicle(playerid, model, Float:x, Float:y, Float:z, Float:fa)
{
    new index = Iter_Free(DynCars);
    if(index > -1)
    {
        Iter_Add(DynCars, index);
        VehicleData[index][p_CarVID] = CreateVehicle(...);
        VehicleData[index][p_CarModel] = model;
        VehicleData[index][p_CarX] = x;
        VehicleData[index][p_CarY] = y;
        VehicleData[index][p_CarZ] = z;
        VehicleData[index][p_CarFA] = fa;
        return index;
    }
    print("AddVehicle::Tried to add too many vehicles");
    return -1;
}

RemoveVehicle(index)
{
    if(Iter_Contains(DynCars, index))
    {
        new next;
        Iter_SafeRemove(DynCars, index, next);
        return next;
    }
    print("RemoveVehicle::Tried to remove a vehicle that does not exist");
    return -1;
}
Reply


Messages In This Thread
2000 cells big array - by Joey^ - 22.10.2014, 18:29
Re: 2000 cells big array - by Pottus - 22.10.2014, 18:43
Re: 2000 cells big array - by Joey^ - 22.10.2014, 18:47
Re: 2000 cells big array - by Pottus - 22.10.2014, 18:59
Re: 2000 cells big array - by Joey^ - 22.10.2014, 19:05

Forum Jump:


Users browsing this thread: 1 Guest(s)