08.08.2013, 17:35
Psymetrix method is not very good either and completely sidesteps the issue of not having your own scripted create and delete vehicle. If you did this then you would be adding vehicles like this....
This should give you a better idea the vehicleid becomes the array reference in VehicleData, this way you can see what the vehicle type is without doing any looping, creating extra arrays etc. In fact you can do the following with this kind of setup
- add many different kinds of vehicles types
- remove any vehicle
- define more data members in the enum to keep track of fuel, position etc
pawn Код:
#define VEHICLE_TYPE_SOMETHING 1
enum VINFO
{
vID,
vType
}
new VehicleData[MAX_VEHICLES][VINFO] = { INVALID_VEHICLE_ID, ... };
AddVehicle(vehicletype, Float:x, Float:y, Float:z, Float:fa, color1, color2, respawntime)
{
new index = CreateVehicle(........);
VehicleData[index][vID] = index;
VehicleData[index][vType] = VEHICLE_TYPE_SOMETHING;
}
IsASomething(vehicleid)
{
if(VehicleData[vehicleid][vType] == VEHICLE_TYPE_SOMETHING) return 1;
return 0;
}
- add many different kinds of vehicles types
- remove any vehicle
- define more data members in the enum to keep track of fuel, position etc