SA-MP Forums Archive
error 035: argument type mismatch (argument 2) - 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: error 035: argument type mismatch (argument 2) (/showthread.php?tid=346066)



error 035: argument type mismatch (argument 2) - cod5devious - 27.05.2012

pawn Код:
CMD:report(playerid, params[])
{
    new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME], str[128], reason, iD;
    if (sscanf(params, "dz", iD, reason)) return SendClientMessage(playerid, COLOR_RED, "Usage: /report [id] [reason]");
    if (iD == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Invalid ID.");
    if (playerid == iD) return SendClientMessage(playerid, COLOR_RED, "You can't report yourself.");
    GetPlayerName(playerid, pName, sizeof(pName));
    GetPlayerName(iD, aName, sizeof(aName));
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            new zName[MAX_PLAYER_NAME], pFile[256];
            GetPlayerName(i, zName, sizeof(zName));
            format(pFile, sizeof(pFile), "Users\%s.ini", zName);
            if (IsPlayerAdmin(i) || dini_Int(pFile, "AdminLevel") >= 1)
            {
                format(str, sizeof(str), "[%d]%s has reported [%d]%s for: %s", playerid, pName, iD, aName, reason);
                SendClientMessageToAdmins(i, COLOR_RED, str);
            }
        }
    }
    return 1;
}
error:
Код:
C:\Users\Jo\Downloads\xantry.pwn(872) : error 035: argument type mismatch (argument 2)
line:
pawn Код:
SendClientMessageToAdmins(i, COLOR_RED, str);
Please help me.

Thanks


Re: error 035: argument type mismatch (argument 2) - Jstylezzz - 27.05.2012

try this:
pawn Код:
SendClientMessageToAdmins(COLOR_RED, str);
I think you don't need to give the playerid, in this case I because it is already defined in the function sendclientmessagetoadmins or something

Try it, and tell it if it worked

So it will be:
pawn Код:
CMD:report(playerid, params[])
{
    new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME], str[128], reason, iD;
    if (sscanf(params, "dz", iD, reason)) return SendClientMessage(playerid, COLOR_RED, "Usage: /report [id] [reason]");
    if (iD == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Invalid ID.");
    if (playerid == iD) return SendClientMessage(playerid, COLOR_RED, "You can't report yourself.");
    GetPlayerName(playerid, pName, sizeof(pName));
    GetPlayerName(iD, aName, sizeof(aName));
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
     
           
                format(str, sizeof(str), "[%d]%s has reported [%d]%s for: %s", playerid, pName, iD, aName, reason);
                SendClientMessageToAdmins(COLOR_RED, str);
           
        }
    }
    return 1;
}



Re: error 035: argument type mismatch (argument 2) - cod5devious - 27.05.2012

now it says
warning 202: number of arguments does not match definition

on the same line.


Re: error 035: argument type mismatch (argument 2) - MP2 - 27.05.2012

Show the SendClientMessageToAdmins function.


Re: error 035: argument type mismatch (argument 2) - cod5devious - 27.05.2012

Fixed it needed like:
SendClientMessageToAdmins(COLOR_RED, str, 1);

Thanks for help +rep to you.


Re: error 035: argument type mismatch (argument 2) - Jstylezzz - 27.05.2012

nevermind, just saw the post above..