How to fix this warning ?
#1

pawn Код:
stock IsPlayerInCopVehicle(playerid)
{
    if(IsPlayerInVehicle(playerid, 427) || IsPlayerInVehicle(playerid, 490) ||
    IsPlayerInVehicle(playerid, 497) || IsPlayerInVehicle(playerid, 523) ||
    IsPlayerInVehicle(playerid, 596) || IsPlayerInVehicle(playerid, 597) ||
    IsPlayerInVehicle(playerid, 598) || IsPlayerInVehicle(playerid, 599))
    return 1; //Line 1125
}

Код:
(1125) : warning 209: function "IsPlayerInCopVehicle" should return a value
Reply
#2

that function only returns a value (1) when that control structure equals true.
But what if that's not the case?
pawn doesen't know what to do.

do it like this:

pawn Код:
stock IsPlayerInCopVehicle(playerid)
{
    if(IsPlayerInVehicle(playerid, 427) || IsPlayerInVehicle(playerid, 490) ||
    IsPlayerInVehicle(playerid, 497) || IsPlayerInVehicle(playerid, 523) ||
    IsPlayerInVehicle(playerid, 596) || IsPlayerInVehicle(playerid, 597) ||
    IsPlayerInVehicle(playerid, 598) || IsPlayerInVehicle(playerid, 599))
        return 1;
    else return 0;
}
btw. relying on assumptions is the worst thing you could ever do.
it could easily mess up stuff. use an array to store the id's

like, when you create the vehicle:
pawn Код:
//globally
new copCar[8];//space for 8 id's (idx from 0 - 7)

//then when creating the cars:
    copCar[0] = CreateVeh....
    copCar[1] = CreateVeh....
    //and so on
Reply
#3

I think that will be a bit faster and better..
pawn Код:
stock IsPlayerInCopVehicle(playerid)
{
    switch(GetPlayerVehicleID(playerid))
    {
        case 427, 490, 497, 523, 596, 597, 598, 599: return 1;
        default: return 0;
    }
}
Reply
#4

fixed thank you all
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)