How to compare vehicle and player's interior?
#8

Just create a new global array and update it everytime you set a vehicle's interior.
Remember vehicle ids start at 1 and not 0, so you have to access the array with vehicleid - 1 or declare the array with MAX_VEHICLES + 1.

Код:
new gVehicleInteriorIDs[MAX_VEHICLES];

n_LinkVehicleToInterior(vehicleid, interior)
{
    LinkVehicleToInterior(vehicleid, interior),
    gVehicleInteriorIDs[vehicleid - 1] = interior;
}
#define LinkVehicleToInterior n_LinkVehicleToInterior

GetVehicleInterior(vehicleid)
{
    return gVehicleInteriorIDs[vehicleid - 1];
}
Make sure to reset the variable when you create new vehicles, otherwise the array could still contain another interior if that slot was used before.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)