Problem with command function
#2

Yeah, well, you're basically nesting all your if-statements. That's what you get for improper use of braces. It compiles like:
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 497)
{
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 487)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 488)
        {
            // And so on ....
        }
    }
}
Which means the model has to be ALL of those vehicles. That is of course never the case and thus your code fails. You could fix it by appending the OR operator to each line (||) but the cleanest solution is a simple switch.
pawn Код:
switch(GetVehicleModel(GetPlayerVehicleID(playerid))
{
    case 497, 487 /* etc, etc */:
    {
        // code
    }
}
Reply


Messages In This Thread
Problem with command function - by semara123 - 06.10.2014, 09:00
Re: Problem with command function - by Vince - 06.10.2014, 10:07
Re: Problem with command function - by semara123 - 09.10.2014, 09:57

Forum Jump:


Users browsing this thread: 2 Guest(s)