error 035: argument type mismatch (argument 2)
#1

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
Reply
#2

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;
}
Reply
#3

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

on the same line.
Reply
#4

Show the SendClientMessageToAdmins function.
Reply
#5

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

Thanks for help +rep to you.
Reply
#6

nevermind, just saw the post above..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)