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

Quote:
Originally Posted by pasha97
Посмотреть сообщение
Try this:

pawn Код:
// My code that displays for all vehicles, not just the ones listed
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(vehicleid == 596||597||598||427||523||599||601)
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "Nice Police Vehicle!");
    }
    return 1;
}
Well the vehicle ID is just the number assigned by the server, so the first vehicle spawned would be 0, the second would be 1 and so on, and not the actual car model.

Quote:
Originally Posted by Romel
Посмотреть сообщение
use OnPlayerStateChange.
I don't see how that would make a difference where I put the code.

EDIT:

Quote:
Originally Posted by iggy1
Посмотреть сообщение
Ignore them^^

Your if statement is wrong. Here is switch, and also how an if statement should be. Use the switch though its better.

pawn Код:
switch( GetVehicleModel(vehicleid) )
{
    case 596, 597, 598, 427, 523, 599, 601:
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "Nice Police Vehicle!");
    }
}

//Or an if statement

new vehiclemodel = GetVehicleModel( vehicleid );

if( vehiclemodel == 596 || vehiclemodel == 597 || vehiclemodel == 427 || vehiclemodel == 523 || vehiclemodel == 599 || vehiclemodel == 601 )
{
    SendClientMessage(playerid, 0xFFFFFFFF, "Nice Police Vehicle!");
}
This is exactly what I was looking for, thanks a ton!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)