[Help] Public IsAPlane
#1

I constantly update my server and add cars to it. Well, for faction reasons I have it set which car belongs to which faction. Example:

public IsAPlane(carid)
{
if(carid == 38 || carid == 55 || carid == 73 || carid == 168 || (carid >= 476) && (carid <= 480) || (carid >= 494) && (carid <= 500) || (carid == 505) || (carid >= 359) && (carid <= 363) || (carid == 365) || (carid == 369))
{
return 1;
}
return 0;
}

Well, when I add new cars it gives it an ID and it throws everything out of balance. Is it possible to use some other method instead of using the car ID's?
Reply
#2

Other methods like what? Give an example how you would like it to be, pls.
Reply
#3

It is more easier if you check the model of the vehicle instead of it's ID, but it only works if you don't care about that the vehicle is the property of a faction or not. For example, this script returns 1 if you are in a plane and it returns 0 if you are not in one. If you want to check if a vehicle belongs to a faction, you have to do it with the vehicle IDs.

pawn Код:
public IsAPlane(carid)
{
   if(GetVehicleModel(carid) == 592 || GetVehicleModel(carid) == 577 || GetVehicleModel(carid) == 511 || GetVehicleModel(carid) == 512 || GetVehicleModel(carid) == 593 || GetVehicleModel(carid) == 520 || GetVehicleModel(carid) == 553 || GetVehicleModel(carid) == 476 || GetVehicleModel(carid) == 519 || GetVehicleModel(carid) == 460 || GetVehicleModel(carid) == 513)
   {
     return 1;
   }
   return 0;
}
Reply
#4

Oh, doing it by the model will be so much easier. Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)