How to check if an int is in an array
#4

I don't understand why people create vehicles like this it is absolutely counter intuitive of how it SHOULD be done quick example to make everything easier.

Код:
#define         VEHICLE_TYPE_NONE       0
#define         VEHICLE_TYPE_NORMAL     1
#define         VEHICLE_TYPE_COPCAR     2

enum VEHICLEINFO
{
	vType,
	Float:vSpawnHP,
}

static VehicleData[MAX_VEHICLES][VEHICLEINFO];
stock CreateFactionVehicle(type, modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay, Float:health=1000.0, addsiren=0)
{
	new index = CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay, addsiren);
    VehicleData[index][vType] = type;
    VehicleData[index][vSpawnHP] = health;
	return index;
}

IsCopCar(vehicleid)
{
	if(vehicleid > 0 && vehicleid < MAX_VEHICLES)
		if(VehicleData[index][vType] == VEHICLE_TYPE_COPCAR)
		    return 1;
	return 0;
}

GetVehicleType(vehicle)
{
    if(vehicleid > 0 && vehicleid < MAX_VEHICLES)
		return VehicleData[vehicleid][vType];
	return VEHICLE_TYPE_NONE;
}
@Jeff what you are doing is extremely silly trying to use vehicleid ranges to determine vehicle types just blows my mind of the sheer illogics of such design.
Reply


Messages In This Thread
How to check if an int is in an array - by adithegman - 18.01.2016, 12:43
Re: How to check if an int is in an array - by BroZeus - 18.01.2016, 14:31
Re: How to check if an int is in an array - by Jefff - 18.01.2016, 14:59
Re: How to check if an int is in an array - by Pottus - 18.01.2016, 15:49
Re: How to check if an int is in an array - by adithegman - 18.01.2016, 16:26
Re: How to check if an int is in an array - by adithegman - 18.01.2016, 16:38

Forum Jump:


Users browsing this thread: 1 Guest(s)