BaniP is not workin! +rep for helping!
#1

pawn Код:
CMD:banip(playerid, params[]){
    new tmp[50], string[128], idx, sendername[MAX_PLAYER_NAME];
    if(IsPlayerConnected(playerid))
    {
        tmp = strtok(params, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, red, "USAGE: /banip [IP]");
            return 1;
        }
        if(PlayerInfo[playerid][Level] >= 6)
        {
            format(string, sizeof(string), "banip %s", tmp);
            SendRconCommand(string);
            SendRconCommand("reloadbans");
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "Adminstrator %s has banned the IP %s", sendername, tmp);
            SaveToFile("BanIPLog",string);
            MessageToAdmins(white,string);
            CMDMessageToAdmins(playerid,"BANIP");
        }
        else
        {
            SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
            return 1;
        }
    }
    return 1;}
Reply
#2

Bump*
Reply
#3

Replace

Код:
format(string, sizeof(string), "banip %s", tmp);
With

Код:
format(string, sizeof(string), "banip %d", tmp);
Hope this helps you, If it has dont forget to +1 rep
Reply
#4

Код:
new target[128];
if (sscanf(params,"s",target))
{
GameTextForPlayer(playerid,"~w~/banip IP",3000,5);
return 1;
}
The above code is an example for sscanf plugin.Try to use this.
Credits to ******.
Reply
#5

An IP address is a string, not an integer.

pawn Код:
CMD:banip(playerid, params[])
{
    if(IsPlayerConnected(playerid)) return 1;
    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /banip [IP]");
    if(PlayerInfo[playerid][Level] < 6) return SendClientMessage(playerid, red, "ERROR: You are not a high enough level to use this command");
    new string[80];
    format(string, sizeof(string), "banip %s", params);
    SendRconCommand(string);
    SendRconCommand("reloadbans");
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "Administrator %s has banned the IP %s", sendername, params);
    SaveToFile("BanIPLog", string);
    MessageToAdmins(white, string);
    CMDMessageToAdmins(playerid, "BANIP");
    return 1;
}
Reply
#6

pawn Код:
format(string, sizeof(string), "banip %s", tmp);
%d [or %i] is for integers, %s is for letters. The IP is in integers. That's why, it's not getting read by the console to ban it. Change it to %d instead.
pawn Код:
format(string, sizeof(string), "banip %d", tmp); // or %i
Reply
#7

Did you just completely ignore my post on purpose or...?

Quote:
Originally Posted by BenzoAMG
An IP address is a string, not an integer.
Reply
#8

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
Did you just completely ignore my post on purpose or...?
Didn't saw it. When I was replying, it was not there.
Reply
#9

It was posted 11 minutes before you submitted yours... Did it take you 11 minutes to type all that?
Reply
#10

Thanks guys for helping me ^_^ rep for who I can.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)