#1

So, I've made this command, but when I /banip, it sends that "Admin %s has banned IP ( [%s ) when I don't have a "[" in sight. Any ideas?

EDIT: Also sent "Banned IP [insertIPhere" in RCON.

pawn Код:
if(strcmp(cmd, "/banip", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GREY, "  <| USAGE: /banip [ip] |>");
                return 1;
            }
            if(PlayerStats[playerid][pAdmin] >= 6)
            {
                new ip;
                ip = strval(tmp);
                format(string, sizeof(string), "banip %s", ip);
                SendRconCommand(string);
                SendRconCommand("reloadbans");
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "  <| Admin %s has banned IP: ( %s ) |>", sendername, ip);
                SendClientMessageToAll(COLOR_LIGHTRED, string);
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "  <| You must be an Administrator to use this command! |>");
                return 1;
            }
        }
        return 1;
    }
Reply
#2

When you're using the command ingame, what are you typing ?
Reply
#3

Quote:
Originally Posted by PrawkC
Посмотреть сообщение
When you're using the command ingame, what are you typing ?
/banip iphere

Example: /banip 127.0.0.1
Reply
#4

pawn Код:
if(strcmp(cmd, "/banip", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GREY, "  <| USAGE: /banip [ip] |>");
                return 1;
            }
            if(PlayerStats[playerid][pAdmin] >= 6)
            {
                format(string, sizeof(string), "banip %s", tmp);
                SendRconCommand(string);
                SendRconCommand("reloadbans");
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "  <| Admin %s has banned IP: ( %s ) |>", sendername, tmp);
                SendClientMessageToAll(COLOR_LIGHTRED, string);
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "  <| You must be an Administrator to use this command! |>");
                return 1;
            }
        }
        return 1;
    }
Reply
#5

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/banip", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GREY, "  <| USAGE: /banip [ip] |>");
                return 1;
            }
            if(PlayerStats[playerid][pAdmin] >= 6)
            {
                format(string, sizeof(string), "banip %s", tmp);
                SendRconCommand(string);
                SendRconCommand("reloadbans");
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "  <| Admin %s has banned IP: ( %s ) |>", sendername, tmp);
                SendClientMessageToAll(COLOR_LIGHTRED, string);
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "  <| You must be an Administrator to use this command! |>");
                return 1;
            }
        }
        return 1;
    }
Worked spot on, thanks so much, I appreciate it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)