Ban IP command?
#1

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

Cheers
Reply
#2

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.
Reply
#3

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 ;_;
Reply
#4

TBH I did not request. I asked a question.. xD
Reply
#5

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)
Reply
#6

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.
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)