error 035: argument type mismatch
#1

hello, im trying to make a offline ban command but i get this:

Код:
lostcity.pwn(7027) : error 035: argument type mismatch (argument 3)
lostcity.pwn(7028) : error 035: argument type mismatch (argument 3)
pawn Код:
CMD:oban(playerid,params[])
{
    new string[124], string1[124], reason[105];
    if(!(pInfo[playerid][pAdminLevel] >= 2)) return SCM(playerid, COLOR_LIGHTBLUE,"You are not authorized to use this command");
    format(string,sizeof(string),"/ZMA/Users/%s.ini",params);
    if(isnull(params)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /oban [Player Name] [Reason]");
    if(!fexist(string)) return SendClientMessage(playerid,-1,"This user account is not found in our database. Please re-check the username.");
    {
        new INI:File = INI_Open(string);
        format(string1, sizeof(string1), "%s has been Offline Banned by %s %s. [REASON: %s]", params,GetAdminName(playerid),PlayerName(playerid),reason);
        SendClientMessageToAll(COLOR_LIGHTBLUE,string1);
        INI_SetTag(File,"data");
        INI_WriteInt(File,"pBanned", 1);
        INI_WriteString(File,"pBanAdmin",GetAdminName(playerid)); //error line 7027
        INI_WriteString(File,"pBanReason",reason); //error line  7028
        INI_Close(File);
    }
    return 1;
}
is im doing wrong?
Reply
#2

Show us GetAdminName function, it must return string for it to be correct...

Not sure about line 7028 though, reason is clearly a string...
Reply
#3

Quote:
Originally Posted by Crayder
Посмотреть сообщение
Show us GetAdminName function, it must return string for it to be correct...

Not sure about line 7028 though, reason is clearly a string...
Im Confused, Here is the GetAdminName:
pawn Код:
stock GetAdminName(playerid)
{
    new adminname[128];
    switch(pInfo[playerid][pAdminLevel])
    {
        case 0: adminname = "Newbie/Regular";
        case 1: adminname = "Trial Moderator";
        case 2: adminname = "Moderator";
        case 3: adminname = "Sr.Moderator";
        case 4: adminname = "Management";
        case 5: adminname = "Head Admin";
        case 6: adminname = "Server Mapper";
        case 7: adminname = "Jr.Manager";
        case 8: adminname = "Sr.Manager";
        case 9: adminname = "Server Scripter";
        case 10: adminname = "Server Founder";
    }
    return adminname;
}
Aslo, is theres a way to get the admin's name?
Reply
#4

i do this: INI_WriteString(File,"pBanAdmin",PlayerName(player id));

but still the same.... here is the stock:

pawn Код:
stock PlayerName(playerid)
{
    new CName[24];
    GetPlayerName(playerid, CName, 24);
    return CName;
}
Reply
#5

take the space out of "player id" and make it "playerid"
Reply
#6

if you put it?

pawn Код:
CMD:oban(playerid,params[])
{
    new string[124], id, string1[124], reason[105];
    if(pInfo[playerid][pAdminLevel] < 2) return SCM(playerid, COLOR_LIGHTBLUE,"You are not authorized to use this command");
    if(sscanf(params, "rs[128]" id, reason)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /oban [Player Name] [Reason]");
    if(!fexist(string)) return SendClientMessage(playerid,-1,"This user account is not found in our database. Please re-check the username.");
    {
        format(string1, sizeof(string1), "%s has been Offline Banned by %s %s. [REASON: %s]", PlayerName(id),adminname,PlayerName(playerid),reason);
        SendClientMessageToAll(COLOR_LIGHTBLUE,string1);
        new INI:File = INI_Open(UserPath(id));
        INI_SetTag(File,"data");
        INI_WriteInt(File,"pBanned", 1);
        INI_WriteString(File,"pBanAdmin",adminname); //error line 7027
        INI_WriteString(File,"pBanReason",reason); //error line  7028
        INI_Close(File);
    }
    return 1;
}
I get what the name of the admin who I imagine ban may be so

pawn Код:
INI_WriteString(File,"pBanAdmin",PlayerName(playerid));
Reply
#7

Quote:
Originally Posted by (SF)Noobanatior
Посмотреть сообщение
take the space out of "player id" and make it "playerid"
There Are No Spaces With it... Its the cause of Italic font.


Quote:
Originally Posted by !R1Ch@rD!
Посмотреть сообщение
if you put it?

pawn Код:
CMD:oban(playerid,params[])
{
    new string[124], id, string1[124], reason[105];
    if(pInfo[playerid][pAdminLevel] < 2) return SCM(playerid, COLOR_LIGHTBLUE,"You are not authorized to use this command");
    if(sscanf(params, "rs[128]" id, reason)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /oban [Player Name] [Reason]");
    if(!fexist(string)) return SendClientMessage(playerid,-1,"This user account is not found in our database. Please re-check the username.");
    {
        format(string1, sizeof(string1), "%s has been Offline Banned by %s %s. [REASON: %s]", PlayerName(id),adminname,PlayerName(playerid),reason);
        SendClientMessageToAll(COLOR_LIGHTBLUE,string1);
        new INI:File = INI_Open(UserPath(id));
        INI_SetTag(File,"data");
        INI_WriteInt(File,"pBanned", 1);
        INI_WriteString(File,"pBanAdmin",adminname); //error line 7027
        INI_WriteString(File,"pBanReason",reason); //error line  7028
        INI_Close(File);
    }
    return 1;
}
I get what the name of the admin who I imagine ban may be so

pawn Код:
INI_WriteString(File,"pBanAdmin",PlayerName(playerid));
Im Confused idk why... can someone made a new oban command for me?
Reply
#8

Nvm.

Edit: Try formatting the name and the reason and use the formatted output as your third argument.
Reply
#9

Nvm, i misread your topic, just ignore this reply
Reply
#10

pawn Код:
CMD:oban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new targetname[24], filestring[79];
        if(sscanf(params, "s[24]", targetname)) return SendClientMessage(playerid, -1, "Usage: /oban [Player Name]");
        format(filestring, sizeof(filestring), "/Users/%s.ini", targetname);
        if(!fexist(filestring)) return SendClientMessage(playerid, COLOR_RED, "Error: Incorrect player/name.");
        else
        {
            new INI:File = INI_Open(filestring);
            INI_SetTag(File, "data");
            INI_WriteInt(File, "Banned", 1);
            INI_Close(File);
            new done[128];
            format(done, sizeof(done), "You have banned %s", targetname);
            SendClientMessage(playerid,-1 , done);
        }
    }
    else SendClientMessage(playerid, -1, "SERVER: Unknown command.");
    return 1;
}
This is my oban..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)