Retrieving one line from a player file.
#6

pawn Код:
CMD:unban(playerid, params[])
{
    new LuckyGuy[MAX_PLAYER_NAME + 6 + 4];
    if(PlayerInfo[playerid][pAdmin] <= 4) return SendClientMessage(playerid, COLOR_RED, "Error: "COL_WHITE" You're not a high enough Administrator.");
    if(sscanf(params, "s[24]", LuckyGuy)) return SendClientMessage(playerid, COLOR_RED, "Error: "COL_WHITE"/unban [Name] (Example: Jammie Dodger)");

    format(LuckyGuy, sizeof(LuckyGuy), PATH, LuckyGuy);

    if(!fexist(LuckyGuy)) return SendClientMessage(playerid, COLOR_RED, "Error: Player doesn't exist! (Tips: Don't use _ | Example Jammie Dodger)");

    new INI:File = INI_Open(LuckyGuy);
    print("File opened");
    INI_SetTag(File, "Statistics");
    print("SetTag");
    INI_WriteInt(File, "Banned", 0);
    print("Set banned");
    INI_Close(File);
    print("Closed File.");
   
    new File:PlayerIP = fopen(LuckyGuy, io_read);
    new string[16 + 7],len;
    while((len = fread(PlayerIP, string)))
    if(strcmp(string, "IP = ", true)==0)
    {
        string[len-2] = 0;
        strdel(string,0,5);
        break; // stop searching
    }

    format(LuckyGuy, sizeof(LuckyGuy), Ban_Path, string);
    if(!fremove(LuckyGuy)) return SendClientMessage(playerid, COLOR_RED, "|-- Error: Account Deletion Failed!");
    SendClientMessage(playerid, COLOR_GREEN, "Account Unbanned!");
    return 1;
}
This says Unknown command..
"/ban player name" 2 parameters? It says it's an unknown command.

E: This is the debug although it said it's an unknown command:
Код:
[19:53:48] File opened
[19:53:48] SetTag
[19:53:48] Set banned
Reply


Messages In This Thread
Retrieving one line from a player file. - by Binx - 18.08.2013, 01:33
Re: Retrieving one line from a player file. - by Binx - 18.08.2013, 15:04
Re: Retrieving one line from a player file. - by Jefff - 18.08.2013, 18:02
Re: Retrieving one line from a player file. - by Binx - 18.08.2013, 18:17
Re: Retrieving one line from a player file. - by Jefff - 18.08.2013, 18:23
Re: Retrieving one line from a player file. - by Binx - 18.08.2013, 18:56
Re: Retrieving one line from a player file. - by avivelkayam - 18.08.2013, 19:04
Re: Retrieving one line from a player file. - by Ada32 - 18.08.2013, 19:19

Forum Jump:


Users browsing this thread: 1 Guest(s)