I cant make work this command
#1

Hello,im trying to make an /unban command to unban a player account:

pawn Код:
CMD:unban(playerid,params[])
{
    new name[MAX_PLAYER_NAME];
    if(PlayerInfo[playerid][pAdmin] < 5) return 0;
    if(sscanf(params,"s[MAX_PLAYER_NAME]",name)) return SendClientMessage(playerid, -1, "Usage: /unban [player name]");
    if(strlen(name) > 24) return SendClientMessage(playerid, red, "The Player Name Must Be Less Than 60 Characters Long.");
    new string[98];
    format(string,sizeof(string),"/Users/%s.ini",name);
    new IsBanned;
    new INI:File = INI_Open(UserPath(playerid));
    {
        INI_Int("Banned");
    }
    if(IsBanned == 0) return SendClientMessage(playerid, red, "This player account is not banned.");
    if(!fexist(string)) return SendClientMessage(playerid, red, "Player account not found, please note the files are CASE SENSITIVE.");
    INI_WriteInt(File,"Banned",0);
    INI_Close(File);
    format(string,sizeof(string),"Player account %s has been unbanned.",name);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    format(string,sizeof(string),"Admin %s has unbanned the player account: %s.",name(playerid),name);
    return 1;
}
I use pInfo.

The variables are:

pBanned
PlayerInfo[playerid][pBanned]

When i compile with that command,i get this errors:

Quote:

C:\Documents and Settings\\Desktop\Cops&Robbers\gamemodes\.pwn(3621 ) : error 017: undefined symbol "INI_Int"
C:\Documents and Settings\\Desktop\Cops&Robbers\gamemodes\.pwn(3629 ) : error 012: invalid function call, not a valid address
C:\Documents and Settings\\Desktop\Cops&Robbers\gamemodes\.pwn(3629 ) : warning 215: expression has no effect
C:\Documents and Settings\\Desktop\Cops&Robbers\gamemodes\.pwn(3629 ) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\\Desktop\Cops&Robbers\gamemodes\.pwn(3629 ) : error 029: invalid expression, assumed zero
C:\Documents and Settings\\Desktop\Cops&Robbers\gamemodes\.pwn(3629 ) : fatal error 107: too many error messages on one line

Line 3621:
pawn Код:
INI_Int("Banned");
Line 3629:
pawn Код:
format(string,sizeof(string),"Admin %s has unbanned the player account: %s.",name(playerid),name);
Thank you for the help.
Reply
#2

Do you have #include < YSI\y_ini > ?
Reply
#3

Quote:
Originally Posted by TzAkS.
Посмотреть сообщение
Do you have #include < YSI\y_ini > ?
Yes,that's not the problem because when i remove that command and i compile, everything works fine.
Reply
#4

make sure u do this:
#include < YSI\y_ini >

CASE SENSITIVE !

and for the rest, here u go fixed one! tried compiling works fine!
pawn Код:
CMD:unban(playerid,params[])
{
    new aname[MAX_PLAYER_NAME];
    if(sscanf(params,"s[MAX_PLAYER_NAME]",aname)) return SendClientMessage(playerid, -1, "Usage: /unban [player name]");
    if(strlen(aname) > 24) return SendClientMessage(playerid, -1, "The Player Name Must Be Less Than 60 Characters Long.");
    new string[98];
    format(string,sizeof(string),"/Users/%s.ini",aname);
    new IsBanned;
    new INI:File = INI_Open(UserPath(playerid));
    {
        INI_Int("Banned");
    }
    if(IsBanned == 0) return SendClientMessage(playerid, -1, "This player account is not banned.");
    if(!fexist(string)) return SendClientMessage(playerid, -1, "Player account not found, please note the files are CASE SENSITIVE.");
    INI_WriteInt(File,"Banned",0);
    INI_Close(File);
    format(string,sizeof(string),"Player account %s has been unbanned.",aname);
    SendClientMessage(playerid, -1, string);
    format(string,sizeof(string),"Admin %s has unbanned the player account: %s.",aname[playerid],aname);
    return 1;
}
Reply
#5

@XtremeR thank you,i get this error now:

error 017: undefined symbol "INI_Int"

And i don't know because i got it
Reply
#6

#include < YSI\y_ini >
the only reason for it!
Reply
#7

Quote:

#include <a_samp>
#include <YSI\y_ini>
#include <sscanf2>
#include <zcmd>
#include <streamer>
#include <irc>
#include <gl_common>

I've it...
Reply
#8

You're using y_ini wrong.
pawn Код:
{
    INI_Int("Banned");
}
What the hell is that even for?

Also, just thought I'd throw this out there.
pawn Код:
if(sscanf(params,"s[MAX_PLAYER_NAME]",name)
is supposed to be
pawn Код:
if(sscanf(params,"s[" #MAX_PLAYER_NAME "]",name)
Reply
#9

So how i can fix it?

Already fixed the params thing.
Reply
#10

Bump.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)