SA-MP Forums Archive
number of arguments does not match definition,IF statement - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: number of arguments does not match definition,IF statement (/showthread.php?tid=477280)



number of arguments does not match definition,IF statement - Tagathron - 23.11.2013

pawn Код:
public CheckPlayerInBank(playerid)
    {
        new playerInteriorBank;
        playerInteriorBank = GetPlayerInterior(playerid);
        if(playerInteriorBank!=2)
        {
            SendClientMessageToAll(COLOR_HOTORANGE, "The man who attempted to rob the bank has failed to do so,as he quit the bank.");
            bankBeingRobbed=0;
        }
        else if(GetPlayerHealth(playerid)==0.0)//THIS LINE
        {
            SendClientMessageToAll(COLOR_HOTORANGE, "The man who attempted to rob the bank has failed to do so,as he has been killed");
            bankBeingRobbed=0;
        }
        return 1;
    }
warning:number of arguments does not match definition

But it's an if statement?


Re: number of arguments does not match definition,IF statement - Patrick - 23.11.2013

You missed a parameter on GetPlayerHealth(..., ...);

pawn Код:
forward CheckPlayerInBank(playerid);
public CheckPlayerInBank(playerid)
{
    new playerInteriorBank, Float:Health;
    playerInteriorBank = GetPlayerInterior(playerid);
    GetPlayerHealth(playerid, Health);

    if(playerInteriorBank != 2)
    {
        SendClientMessageToAll(COLOR_HOTORANGE, "The man who attempted to rob the bank has failed to do so,as he quit the bank.");
        bankBeingRobbed=0;
    }
    else if(Health == 0.0)
    {
        SendClientMessageToAll(COLOR_HOTORANGE, "The man who attempted to rob the bank has failed to do so,as he has been killed");
        bankBeingRobbed=0;
    }
    return 1;
}



Re: number of arguments does not match definition,IF statement - Tagathron - 23.11.2013

Ah.Thanks,i though i only need the playerid param,as it's the only one it is suggested when i type
GetPlayerHealth(