SA-MP Forums Archive
Ban IP command? - 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: Ban IP command? (/showthread.php?tid=602907)



Ban IP command? - Kreatyve - 15.03.2016

Is there anyway to make a banip command instead of having to use rcon?

Cheers


Re: Ban IP command? - MicroKyrr - 15.03.2016

You violate the rules.You are in wrong section.This place is not for requesting script

PHP код:
CMD:banip(playeridparams[])
{
    new 
type128 ], string[128];
    if(
sscanf(params"s[128]"type)) SendClientMessage(playerid, -1"Usage: /banip [IP]");
    else
    {
         
format(stringsizeof(string),"banip %s"type);
        
SendRconCommand(string);
        
SendRconCommand("reloadbans");
    }
    return 
true;
}
CMD:unbanip(playeridparams[])
{
    new 
type[128],string[128];
    if(
sscanf(params"s[128]"type)) SendClientMessage(playerid, -1"USAGE: /unbanip [Players IP]");
    else
    {
        if(
PlayerInfo[playerid][pPlayerLogged] == 0) return SendClientMessage(playerid, -1"* You are not logged in!");
        
        if(
PlayerInfo[playerid][pAdminLevel] >= 1)
        {
            
format(stringsizeof(string),"unbanip %s"type);
            
SendRconCommand(string);
            
SendRconCommand("reloadbans");
                     
format(stringsizeof(string), "AdmWarning: %s has unbanned IP %s"Nameplayerid ), type);
            
SendAdminMessage(-1,string);
        }
        else
        {
            return 
SendClientMessage(playerid, -,"You dont have access!");
        }
    }
    return 
true;

Easy to search.Anyway , change the admin variable to your own, you need sscanf2 and zcmd so it will work.


Re: Ban IP command? - jlalt - 15.03.2016

yes, by using https://sampwiki.blast.hk/wiki/SendRconCommand

PHP код:
CMD:banip(playerid,params[]) {
   if(!
IsPlayerAdmin(playerid)) return 0;
   if(
isnull(params)) return SendClientMessage(playerid,-1,"SERVER: Usage: /banip [ip]");
   new 
string[128];
   
format(string,sizeof string,"banip %s",params);
   
SendRconCommand(string);
   
SendRconCommand("reloadbans");
   
format(string,sizeof string,"SERVER: Ip successfully banned");
   return 
SendClientMessage(playerid,-1,string);
   return 
1;


Quote:
Originally Posted by MicroKyrr
Посмотреть сообщение
PHP код:
CMD:unbanip(playeridparams[])
{
    new 
type[128],string[128];
    if(
sscanf(params"s[128]"type)) SendClientMessage(playerid, -1"USAGE: /unbanip [Players IP]");
    else
    {
        if(
PlayerInfo[playerid][pPlayerLogged] == 0) return SendClientMessage(playerid, -1"* You are not logged in!");
        
        if(
PlayerInfo[playerid][pAdminLevel] >= 1)
        {
            
format(stringsizeof(string),"unbanip %s"type);
            
SendRconCommand(string);
            
SendRconCommand("reloadbans");
                     
format(stringsizeof(string), "AdmWarning: %s has unbanned IP %s"Nameplayerid ), type);
            
SendAdminMessage(-1,string);
        }
        else
        {
            return 
SendClientMessage(playerid, -,"You dont have access!");
        }
    }
    return 
true;

very nice copy paste ;_;


Re: Ban IP command? - Kreatyve - 15.03.2016

TBH I did not request. I asked a question.. xD


Re: Ban IP command? - JaKe Elite - 15.03.2016

There is a way to do it, Which will involve with listing all the banned IPs (every banned players gets their IP added on the banned IPs txt file) Once you decided to unban them, You can remove the banned ip from the file (I dont know how to do it, But it's possible) I prefer using Range Banning (which involves banning the starting IP instead of the whole IP, this prevents the user from changing IP)


Re: Ban IP command? - MicroKyrr - 15.03.2016

Quote:
Originally Posted by jlalt
Посмотреть сообщение
yes, by using https://sampwiki.blast.hk/wiki/SendRconCommand

PHP код:
CMD:banip(playerid,params[]) {
   if(!
IsPlayerAdmin(playerid)) return 0;
   if(
isnull(params)) return SendClientMessage(playerid,-1,"SERVER: Usage: /banip [ip]");
   new 
string[128];
   
format(string,sizeof string,"banip %s",params);
   
SendRconCommand(string);
   
SendRconCommand("reloadbans");
   
format(string,sizeof string,"SERVER: Ip successfully banned");
   return 
SendClientMessage(playerid,-1,string);
   return 
1;



very nice copy paste ;_;
Not written in the rules . Just asking , you have a problem with that :S Peace.


Re: Ban IP command? - saffierr - 15.03.2016

Where did he request for a script? He just asked something. Stop saying things before thinkig...