Help me please with banip and unban command
#1

pawn Код:
CMD:banip(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
        new command[128], string[128], ip;
        if(sscanf(params,"us", ip)) return SendClientMessage(playerid, C_WHITE, "USAGE: /ipban [Banned IP]");
        {
            format(string, sizeof(string), "aCMD: %s banned someone", Name(playerid));
            SendClientMessageToAll(C_RED, string);
            format(command,sizeof(command),"banip %s", ip);
            SendRconCommand(command);
            printf("UNBAN Executed by %i",playerid);
            SendRconCommand("reloadbans");
        }
    }
    return 1;
}
pawn Код:
CMD:unban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 4)
    {
        new command[128], string[128], ip;
        if(sscanf(params,"us", ip)) return SendClientMessage(playerid, C_WHITE, "USAGE: /unban [Banned IP]");
        {
            format(string, sizeof(string), "aCMD: %s unbanned someone", Name(playerid));
            SendClientMessageToAll(C_RED, string);
            format(command,sizeof(command),"unbanip %s", ip);
            SendRconCommand(command);
            printf("UNBAN Executed by %i",playerid);
            SendRconCommand("reloadbans");
        }
    }
    return 1;
}

What is wrong?
Reply
#2

pawn Код:
if(sscanf(params,"us", ip)) return SendClientMessage(playerid, C_WHITE, "USAGE: /unban [Banned IP]")
pawn Код:
if(sscanf(params,"s[64]", ip)) return SendClientMessage(playerid, C_WHITE, "USAGE: /unban [Banned IP]")
Reply
#3

EDIT: Nevermind, wasn't paying attention to the code.
Reply
#4

Glad2BeHere, that code doesn't work
Reply
#5

Ok i fixed it

Old:
pawn Код:
new command[128], string[128], ip;        
if(sscanf(params,"us", ip)) return SendClientMessage(playerid, C_WHITE, "USAGE: /unban [Banned IP]");
New:
pawn Код:
new command[128], string[128], ip[16];
if(sscanf(params,"s[16]", ip)) return SendClientMessage(playerid, C_WHITE, "USAGE: /unban [Banned IP]");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)