Collecting vehicle ID problem
#1

Well I have my vehicle system and it's dynamic. When I load vehicles in, it loops and searches for everything it needs to - if a vehicle is in a garage. It wont create. So through variables I have created this.. but my problem is if I use GetPlayerVehicleID on a vehicle that has a higher ID than a vehicle inside a garage it fucks the whole ID up. It's really hard to explain, atleast for me. So, I was wondering is there a way I can collect the ID of a vehicle a different way?

Current structure:

pawn Код:
#define MAX_VEHICLES 2000
enum iVehicle
{
    iD,
    owner,
    InGarage,
}
new Vehicle[MAX_VEHICLES][iVehicle];
I have tryed this:

pawn Код:
stock GetDeletedVehicles()
{
    new count;
    VehLoop(v)
    {
        if(Vehicle[v][vActive] != 1) continue;
        if(Vehicle[v][InGarage] != 0) count++;
    }
    return count;
}
but with this way I would have to find the ID of the car then break;

Then:

pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
vehicleid += GetDeletedVehicles();
pawn Код:
stock ReloadVehicle(v)
{
    format(SmllStr, sizeof(SmllStr), "Vehicles/vID-%d.ini", v);
    Vehicle[v][vID] = dini_Int(SmllStr, "vID");
    Vehicle[v][vehX] = dini_Float(SmllStr, "vehX");
    Vehicle[v][vehY] = dini_Float(SmllStr, "vehY");
    Vehicle[v][vehZ] = dini_Float(SmllStr, "vehZ");
    Vehicle[v][vehA] = dini_Float(SmllStr, "vehA");
    Vehicle[v][int] = dini_Int(SmllStr, "vehINT");
    Vehicle[v][vw] = dini_Int(SmllStr, "vehVW");
    myStrcpy(Vehicle[v][owner], dini_Get(SmllStr, "owner"));
    myStrcpy(Vehicle[v][dupekey], dini_Get(SmllStr, "dupekey"));
    myStrcpy(Vehicle[v][vPlate], dini_Get(SmllStr,  "Plate"));
    Vehicle[v][InGarage] = dini_Int(SmllStr, "Garage");
    Vehicle[v][FactionID] = dini_Int(SmllStr, "FactionID");
    Vehicle[v][model] = dini_Int(SmllStr, "model");
    Vehicle[v][colour1] = dini_Int(SmllStr, "colour1");
    Vehicle[v][colour2] = dini_Int(SmllStr, "colour2");
    Vehicle[v][paintjob] = dini_Int(SmllStr, "paintjob");
    Vehicle[v][type] = dini_Int(SmllStr, "type");
    if(Vehicle[v][InGarage] == 0)
    {
        Vehicle[v][pModel] = CreateVehicle(Vehicle[v][model], Vehicle[v][vehX], Vehicle[v][vehY], Vehicle[v][vehZ], Vehicle[v][vehA],  Vehicle[v][colour1], Vehicle[v][colour2], -1);
        SetVehicleVirtualWorld(Vehicle[v][pModel], Vehicle[v][vw]);
        SetVehicleNumberPlate(Vehicle[v][pModel], Vehicle[v][vPlate]);
        SetVehicleToRespawn(Vehicle[v][pModel]);
    }
    if(strcmp(Vehicle[v][owner], "None"))
    {
        SetVehicleEngineOff(v);
    }
    printf("Vehicle ID: %d - ReloadVehicle(%d)", v, v);
}
But, this only works when there are 0 vehicles in a garage.


Summary:
When I GetPlayerVehicleID(playerid); it works, but it grabs a whole other ID.


Sorry, for confusion - I have confused myself.
Reply
#2

Your garage system is quite strange : explain more about that.

A simple boolean variable can't mess up (fuck is a bit stronger) the ID's system of SAMP.
Remember that the function only works if the player is IN a vehicle, correctly sit down.
Reply
#3

He means it gets the vehicle ID which the player is in, according to the IDs system of SAMP, but not according to his own vehicle system.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)