Unban command with DCMD and y_ini file system.
#3

Quote:
Originally Posted by Delux13
Посмотреть сообщение
Try this:
pawn Код:
dcmd_unban(playerid, params[]) // Level 1
{
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not authorized to use this command!");
new user[128], string[128];
if(sscanf(params, "s[128]", user)) return SendClientMessage(playerid, COLOR_ORANGE, "CMD: /unban [Full Player Name]");
format(user, sizeof(user), "%s.ini", user);
if(INI_Exists(user))
    {
        new INI:File = INI_Open(user);
        printf(user);
        printf("User file opened");
        INI_SetTag(File,"Main");
        INI_WriteInt(File, "Banned", 0);
        printf("User file unbanned");
        format(string, sizeof(string), "None");
        INI_WriteString(File, "BanReason", string);
        printf("Banned reason changed");
        INI_Close(File);
        printf("File closed");
        format(string, sizeof(string), "Admin %s has unbanned the account '%s'", PlayerName(playerid), user);
        SendClientMessageToAll(COLOR_LIGHTRED, string);
    }
    else
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "User not found!");
    }
    return 1;
}
No good, it sends me "Server: unknown command"
I looked at my debug, and the code stops before it tells it to close the file... so something wrong there.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)