IsVehicleAirVehicle
#1

Does someone know about a_westie? I think it defines IsVehicleAirVehicle and i can't fine that include. Please if any one knows how to define it, post it here or if someone has the include's link, please post it too.
Reply
#2

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
Reply
#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
#4

absolutely yes way, u can use your case with bigger values see how it goes!!
Reply
#5

he's saying that's a terrible use of a 2d array and he's correct, you should't be using strings if there's no need
Reply
#6

thx especially park4mbx and cessil cuz park4mbx's IsVehicleAirVehicle worked but i got a lil' problem....

Код:
C:\Users\ADDL\Desktop\Samp\pawno\include\sscanf2.inc(69) : warning 235: public function lacks forward declaration (symbol "OnNPCModeInit")
C:\Users\ADDL\Desktop\Samp\pawno\include\cnpc.inc(1) : error 010: invalid function or declaration
C:\Users\ADDL\Desktop\Samp\pawno\include\cnpc.inc(174) : error 010: invalid function or declaration
...

on line 63 there is....

Код:
#define COLOUR_YELLOW 0xFFFF2AFF
on line 1 there is....

nothing :P

on line 174 there is.....

lol nothing :P


ok, help me out guys...again please.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)