SA-MP Forums Archive
Argument mismatch 1 and 2 on same line - 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: Argument mismatch 1 and 2 on same line (/showthread.php?tid=370787)



Argument mismatch 1 and 2 on same line - Euan Hughes - 21.08.2012

So im getting arguments mismatch 1 and 2 on the same line....

Here is the command

pawn Код:
command(remotewarn, playerid, params[])
{
    new pName, name[128], reason[128], string[128];
    if(sscanf(params, "ds", name, reason))
    {
        if(Player[playerid][AdminLevel] >= 5)
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /remotewarn [name] [reason]");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 5)
        {
            GetPlayerName(name, pName, sizeof(pName));
            format(string, sizeof(string), "Accounts/%s.ini", name);

            if(fexist(string))
            {
                if(strcmp(Player[pName][Warning1], "None", true) == 0)
                {
                    SendClientMessage(playerid, WHITE, "You can't prison a higher level administrator (or equal to your rank).");
                }
                else
                {
                    SendClientMessage(playerid, WHITE, "dfhgkfjd");
                }
            }
            else
            {
                SendClientMessage(playerid, WHITE, "Account not found.");
            }
        }
    }
}
And the error is on

pawn Код:
GetPlayerName(name, pName, sizeof(pName));
Please help

Thanks


Re: Argument mismatch 1 and 2 on same line - [MWR]Blood - 21.08.2012

pawn Код:
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));



Re: Argument mismatch 1 and 2 on same line - Euan Hughes - 21.08.2012

Quote:
Originally Posted by [MWR]Blood
Посмотреть сообщение
pawn Код:
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
Now its only argument mismatch 1 and now i have Array must be indexed pName

pawn Код:
if(strcmp(Player[pName][Warning1], "None", true) == 0)
Please help

Thanks


Re: Argument mismatch 1 and 2 on same line - [MWR]Blood - 21.08.2012

You have to use the playerid, not the player's name:
pawn Код:
if(strcmp(Player[playerid][Warning1], "None", true) == 0)



Re: Argument mismatch 1 and 2 on same line - Euan Hughes - 21.08.2012

Quote:
Originally Posted by [MWR]Blood
Посмотреть сообщение
You have to use the playerid, not the player's name:
pawn Код:
if(strcmp(Player[playerid][Warning1], "None", true) == 0)
That will only check if i have any warnings though

Please help

Thanks