Dini help.
#1

pawn Код:
COMMAND:unban(playerid, params[])
{
        if(PInfo[playerid][Admin] < 4) return SendClientMessage(playerid, COLOR_RED, "{F81414}[ERROR]: {FFFFFF}This command is not available in this server! Type {F81414}/help {FFFFFF}for a list of commands.");
        new pplayerid;
        if(sscanf(params, "s",pplayerid)) return SendClientMessage(playerid, COLOR_RED, ""COL_RED"[ERROR]: "COL_WHITE"Usage: /unban [Player Name]");
        if(PInfo[playerid][pBan] == 1)
        {
            new file[128], pname[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pname, sizeof(pname));
            format(file, sizeof(file), "SenjoritaGaming/Users/%s.ini", pname);
            if(dini_Exists(file))
            {
                PInfo[pplayerid][pBan] = 0;
                SendClientMessage(playerid,-1,""COL_GREEN"[SYSTEM]: "COL_WHITE"You have unbanned the player!");
                return 1;
            }
            else if(!dini_Exists(file))
            {
                SendClientMessage(playerid,-1,""COL_RED"[ERROR]: "COL_WHITE"The player doesn't exist!");
                return 1;
            }
        }
        else if(PInfo[playerid][pBan] == 0)
        {
            SendClientMessage(playerid,-1,""COL_RED"[ERROR]: "COL_WHITE"The player is not banned!");
            return 1;
        }
        return 1;
}
COMMAND:ban(playerid, params[])
{
        if(PInfo[playerid][Admin] < 3) return SendClientMessage(playerid, COLOR_RED, "{F81414}[ERROR]: {FFFFFF}This command is not available in this server! Type {F81414}/help {FFFFFF}for a list of commands.!");
        new pplayerid,reason[48],string[128];
        if(sscanf(params, "us[48]", pplayerid, reason)) return SendClientMessage(playerid, COLOR_RED,""COL_RED"[ERROR]: "COL_WHITE"Usage: /ban [Player ID/Player Name] [Reason]");
        if(IsPlayerConnected(pplayerid))
        {
            if(pplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, ""COL_RED"[ERROR]: "COL_WHITE"Wrong playerid!");
            if(PInfo[pplayerid][Admin] == 6) return SendClientMessage(playerid, COLOR_RED, ""COL_RED"[ERROR]: "COL_WHITE"You can't ban me!");
            format(string,sizeof(string),""COL_BLUE"[SYSTEM]: "COL_RED"Admin "COL_WHITE"%s "COL_RED"has banned player "COL_WHITE"%s  "COL_RED"Reason: %s",GetName(playerid),GetName(pplayerid),reason);
            SendClientMessageToAll(-1,string);
            PInfo[pplayerid][pBan] = 1;
        }
        if(!IsPlayerConnected(pplayerid))
        {
            new file[128], pname[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pname, sizeof(pname));
            format(file, sizeof(file), "SenjoritaGaming/Users/%s.ini", pname);
            if(dini_Exists(file))
            {
                PInfo[pplayerid][pBan] = 1;
                format(string,sizeof(string),""COL_BLUE"[SYSTEM]: "COL_RED"Admin "COL_WHITE"%s "COL_RED"has banned player "COL_WHITE"%s  "COL_RED"Reason: %s",GetName(playerid),GetName(pplayerid),reason);
                SendClientMessageToAll(-1,string);
            }
            else
            {
                SendClientMessage(playerid,-1,""COL_RED"[ERROR]: "COL_WHITE"Player is not in the system!");
                return 1;
            }
        }
        return 1;
}
I'm sorry I'm not good at DINI.
But anyways It doesn't work. I mean when i try to ban the offline person it says, Wrong command. Then when I try to unban it doesn't. o.e Help?
Reply
#2

It seems to check if you're banned rather than checking the ID you enter
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)