Unban command with DCMD and y_ini file system.
#5

Quote:
Originally Posted by FireCat
Посмотреть сообщение
He wants to send the message to all admins!
Not just everyone.
So 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],PlayerName[24];
if(sscanf(params, "s[128]", PlayerName)) return SendClientMessage(playerid, COLOR_ORANGE, "CMD: /unban [Full Player Name]");
format(user, sizeof(user), "%s.ini", PlayerName);
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");
        foreach(Player ,i)
        {
            if(PlayerInfo[i][pAdmin] >= 1)
            {
                format(string, sizeof(string), "Admin %s has unbanned the account '%s'", PlayerName(playerid), user);
                SendClientMessage(i, COLOR_LIGHTRED, string);
            }
        }
        return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "User not found!");
        return 1;
    }
return 1;
}
That gave me a few errors
Код:
(1209) : warning 219: local variable "PlayerName" shadows a variable at a preceding level
(1229) : error 012: invalid function call, not a valid address
(1229) : warning 215: expression has no effect
(1229) : error 001: expected token: ";", but found ")"
(1229) : error 029: invalid expression, assumed zero
(1229) : fatal error 107: too many error messages on one line
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)