Problem with if(GetVehicleModel(vehicleid) == 596||597||598||427||523||599||601)
#1

I am wanting to have some functions only run if the vehicle id is a certain vehicle model.
I know that || is supposed to mean "or" when in an "if"

So that if I did something like:
pawn Код:
// My code that displays for all vehicles, not just the ones listed
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == 596||597||598||427||523||599||601)
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "Nice Police Vehicle!");
    }
    return 1;
}
One thing it does fine is sending the message.
What is does wrong is that it sends it for all vehicles and not just the IDs specified (police vehicles)

Is there something I am doing wrong, or is it bugged, since the Wiki example for GetVehicleModel is exactly the same, except for the fact I am using || so that it will display on more then just the one ID:
pawn Код:
// Example from the wiki https://sampwiki.blast.hk/wiki/GetVehicleModel
public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger)
{
    if(GetVehicleModel(vehicleid) == 411) // 411 is the infernus model
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "Nice Infernus!");
    }
    return 1;
}
Thanks for any help!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)