unban cmd error
#1

I took this code from this forum only but im getting else erros and dont know how to fix it.Help will be appreciated.
Code:
Код:
CMD:unban(playerid, params[])
{
        new string[128];
        new pName[24];
        if(isnull(params)) return SendClientMessage(playerid, -1, "{FF0099}[ADMIN]{FFFFFF} /unban [playername]");
        {
            format(string, 128, "{FF0099}[ADMIN]{FFFFFF} '%s' has been unbanned by %s.", params,pName);
            SendClientMessageToAll(COLOR_ADMIN,string);
            new year, month,day;
            getdate(year, month, day);
            new playa[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playa, MAX_PLAYER_NAME);
            format(string, sizeof(string), "{FF0099}[ADMIN]{FFFFFF} '%s' has been unbanned by %s.", params, playa);
            SendClientMessageToAll(COLOR_ADMIN, string);
        }
        else
        {
            SendClientMessage( playerid, -1, "{FF0000}[ERROR]{FFFFFF}Not a banned account or no such account was found!" );
        }
    return 1;
}
Reply
#2

Show us your errors?
Reply
#3

Код:
C:\Users\HACKIFYOUCAN\Desktop\NEW\FunGaming Stunt-Freeroam\gamemodes\SFCRRPG.pwn(5502) : error 029: invalid expression, assumed zero
In line 5502 its like this
Код:
}
        else
}
Reply
#4

Must be:
Код:
}
else
{
Reply
#5

you need to define a condition
Код:
new string[128];
        new pName[24];
        if(isnull(params)) return SendClientMessage(playerid, -1, "{FF0099}[ADMIN]{FFFFFF} /unban [playername]");
        if(//File present)//like this
        {
            format(string, 128, "{FF0099}[ADMIN]{FFFFFF} '%s' has been unbanned by %s.", params,pName);
            SendClientMessageToAll(COLOR_ADMIN,string);
Reply
#6

@Unknown its like that only but i was unable to make it like that overhere.
Hanuman im testng it right now!NOt working.
Another one please
Reply
#7

I'm using this one
pawn Код:
CMD:unban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pBanAppealer] >= 1)
    {
        if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 5)
        {
            SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
            return 1;
        }

        new string[128];
        if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [playername]");

        if(doesAccountExist(params))
        {
            OnPlayerOfflineLogin(params);
            if(PlayerInfo[MAX_PLAYERS][pPermaBanned] == 1)
            {
                SendClientMessage(playerid, COLOR_WHITE, "Permanently banned accounts can only be unbanned via FTP.");
            }
            else
            {
                if(PlayerInfo[MAX_PLAYERS][pBanned] >= 1)
                {
                    PlayerInfo[MAX_PLAYERS][pBanned] = 0;

                    if(PlayerInfo[MAX_PLAYERS][pWarns] == 3)
                        PlayerInfo[MAX_PLAYERS][pWarns] = 0;

                    RemoveBan(PlayerInfo[MAX_PLAYERS][pIP]);
                    OnPlayerOfflineSave(params);
                    format(string, 128, "AdmCmd: %s (IP:%s) was unbanned by %s.", params, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid));
                    ABroadCast(COLOR_LIGHTRED,string,2);
                    format(string, sizeof(string), "AdmCmd: %s (IP:%s) was unbanned by %s.", params, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid));
                    Log("logs/ban.log", string);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "Not a banned account!");
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "That account doesn't exist.");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
    }
    return 1;
}
Reply
#8

The command is incomplete. You check an if statement and then you return an error message. After than you open a bracket and do the code to unban (even though, it's just message. It doesn't actually unban the player) and then you check an else statement when you didn't use an if before. Like Hanuman said, you need to use an if statement that checks if the player is banned (everything depends on how you ban a player).

If you don't know how to make a simple ban/unban command by yourself, check some tutorials or filterscripts out. It will help you a lot!
Reply
#9

u are using dini or YSI?
Reply
#10

dini
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)