IsVehicleAirVehicle
#3

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;
}
Reply


Messages In This Thread
IsVehicleAirVehicle - by iSkate - 23.12.2013, 06:45
Re: IsVehicleAirVehicle - by park4bmx - 23.12.2013, 09:38
Re: IsVehicleAirVehicle - by Konstantinos - 23.12.2013, 10:30
Re: IsVehicleAirVehicle - by park4bmx - 23.12.2013, 11:49
Re: IsVehicleAirVehicle - by cessil - 23.12.2013, 11:54
Re: IsVehicleAirVehicle - by iSkate - 24.12.2013, 14:52

Forum Jump:


Users browsing this thread: 5 Guest(s)