Quote:
Originally Posted by park4bmx
pawn Код:
new AirVehicleIDS[21][] = { {"417"},{"425"},{"447"},{"460"},{"469"},{"476"}, {"487"},{"488"},{"497"},{"511"},{"512"},{"513"}, {"519"},{"520"},{"548"},{"553"},{"563"},{"577"}, {"592"},{"593"}}; stock IsVehicleAirVehicle(ID) { for(new i=0; i < sizeof(AirVehicleIDS); i++) { if(strval(AirVehicleIDS[i]) == ID) return 1; } return 0; }
something like that maybe,
returns 1 if the vehicle ID is a air type vehicle
and returns 0 if its not
|
Absolutely no way of using a 2D array and comparing like that when you could've used a single array that contains ONLY integers. Either way, it's still a bad idea of looping when you can just check with a single switch.
pawn Код:
stock IsVehicleAirVehicle(vehicleid)
{
switch (GetVehicleModel(vehicleid))
{
case 417, 425, 447, 460, 469, 476, 487, 488, 497, 511 .. 513, 519, 520, 548, 553, 563, 577, 592, 593: return 1;
}
return 0;
}