Isbanned
#1

Hello, i just made this command to check if a player (offline) is banned or not. It reads from the player file but there is a problem:

pawn Код:
CMD:isbanned(playerid,params[])
{
    if(PlayerInfo[playerid][pLogged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command.");
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
    new name[128];
    if(sscanf(params, "s[128]",name)) return SCM(playerid,-1,"{F70505}Usage: {FFFFFF}/isbanned <account name>");

    new string[128];
    new ss;
    new filestring[128];
    format(filestring, sizeof(filestring), "Users/%s.ini", name);
    if(!fexist(filestring)) return SCM(playerid,red, "Player account not found.");
    else
    {
        new INI:File = INI_Open(filestring);
        INI_SetTag(File, "data");
        ss = INI_Load("Banned", name);
        INI_Close(File);
        switch(ss)
        {
            case 0:
            {
                format(string,sizeof string,"%s's account is banned.");
                SCM(playerid,COLOR_YELLOW,string);
            }
            case 1:
            {
                format(string,sizeof string,"%s's account is not banned.");
                SCM(playerid,COLOR_YELLOW,string);
            }
        }
    }
    }
    return 1;
}
(7453) : error 035: argument type mismatch (argument 2)

Line 7453:
pawn Код:
ss = INI_Load("Banned", name);
Thanks.
Reply
#2

Change to
pawn Код:
new
    ss[ 24 ]
;
Reply
#3

I don't think INI_Load returns what is stored in "Banned".
Reply
#4

Quote:
Originally Posted by cosbraa
Посмотреть сообщение
I don't think INI_Load returns what is stored in "Banned".
Then what?

Quote:
Originally Posted by Dwane
Посмотреть сообщение
Change to
pawn Код:
new
    ss[ 24 ]
;
error 035: argument type mismatch (argument 2)
error 033: array must be indexed (variable "ss")
error 033: array must be indexed (variable "-unknown-")
Reply
#5

Actually, it should be like this
pawn Код:
// An example || Originally posted by ******
INI_Load("myini.ini");

INI:myini[](name[], value[])
{
    INI_String("a", gA, len_of_gA);
    INI_String("b", gB, len_of_gB);
    INI_String("c", gC, len_of_gC);
    return 0; // This is now required.
}
You cannot use
pawn Код:
INI_Load("Banned", name)
as you did.
Reply
#6

you can use INI_Int
pawn Код:
INI_Int("Banned", ss);
Reply
#7

Nope, doesn't work.
Reply
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
Have you even read the y_ini tutorial?
A better question would have been has he read ANYTHING at all!

Quote:
Originally Posted by Logitech90
Join Date: Jan 2010
Posts: 2,588
Reputation: 162
You have been spoon-fed throughout ALL your time here on the SA-MP forums. Some thoughtful advice: USE the internet!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)