Function should return a value
#1

pawn Код:
stock IsFBIVehicles(playerid)
{
    for(new i=9; i<sizeof(fbicar); i++)
    if(GetPlayerVehicleID(playerid) == fbicar[i])
    return 1;
}
Compiling fails with "warning 209: function "IsFBIVehicles" should return a value" I dont see whats wrong D:
Reply
#2

where are u using it?
Reply
#3

You need to create a return value if IsFBIVehicles is not true.

pawn Код:
stock IsFBIVehicles(playerid)
{
    for(new i=9; i<sizeof(fbicar); i++)
        if(GetPlayerVehicleID(playerid) == fbicar[i])
           return 1;
        else
           return 0;
}
Reply
#4

Quote:
Originally Posted by Cyanide
Посмотреть сообщение
You need to create a return value if IsFBIVehicles is not true.
pawn Код:
//CODE
Here a working version

pawn Код:
stock IsFBIVehicles(playerid) {
    playerid = GetPlayerVehicleID(playerid);
    if(playerid) {
        for(new i = 9; i != sizeof fbicar; ++i) {
            if(playerid == fbicar[i]) {
                return true;
            }
        }
    }
    return false;
}
@McCarthy
Just indent your code correctly and use brackets till you are advanced enough to leave them away
Reply
#5

Thank you Nero..can you fix this too?

pawn Код:
public Repair(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        PlayerPlaySound(playerid,1134,0,0,0);
        RepairVehicle(GetPlayerVehicleID(playerid));
        return 1;
    }
}
Reply
#6

Quote:
Originally Posted by McCarthy
Посмотреть сообщение
Thank you Nero..can you fix this too?

pawn Код:
public Repair(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        PlayerPlaySound(playerid,1134,0,0,0);
        RepairVehicle(GetPlayerVehicleID(playerid));
        return 1;
    }
}
PHP код:
public Repair(playerid)
{
    if(
IsPlayerInAnyVehicle(playerid))
     {
        
PlayerPlaySound(playerid,1134,0,0,0);
          
RepairVehicle(GetPlayerVehicleID(playerid));
    }
        return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)