SA-MP Forums Archive
BaniP is not workin! +rep for helping! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: BaniP is not workin! +rep for helping! (/showthread.php?tid=513505)



BaniP is not workin! +rep for helping! - KillerStrike23 - 16.05.2014

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;}



Re: BaniP is not workin! +rep for helping! - KillerStrike23 - 17.05.2014

Bump*


Re: BaniP is not workin! +rep for helping! - Ciandlah - 17.05.2014

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


Re: BaniP is not workin! +rep for helping! - Rittik - 17.05.2014

Код:
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 ******.


Re: BaniP is not workin! +rep for helping! - Threshold - 17.05.2014

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;
}



Re: BaniP is not workin! +rep for helping! - Parallex - 17.05.2014

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



Re: BaniP is not workin! +rep for helping! - Threshold - 17.05.2014

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

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



Re: BaniP is not workin! +rep for helping! - Parallex - 17.05.2014

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.


Re: BaniP is not workin! +rep for helping! - Threshold - 17.05.2014

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


Re: BaniP is not workin! +rep for helping! - KillerStrike23 - 17.05.2014

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