SA-MP Forums Archive
Change name ban to ip ban - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Change name ban to ip ban (/showthread.php?tid=257947)



Change name ban to ip ban - ColdIce - 28.05.2011

Can someone change this code and post it back? I want it to ipban, not just name ban

pawn Код:
dcmd_ban(playerid,params[])
{
    if(AccInfo[playerid][LoggedIn] == 1)
    {
        if(AccInfo[playerid][Level] >= 4)
        {
            new Index;
            new tmp[256];  tmp  = strtok(params,Index);
            new tmp2[256]; tmp2 = strtok(params,Index);
           
            if(!strlen(params)) return
            SendClientMessage(playerid, LIGHTBLUE2, "Usage: /ban [PlayerID] [Reason]") &&
            SendClientMessage(playerid, orange, "Function: Will Ban the specified player");
            if(!strlen(tmp2))
            return SendClientMessage(playerid, red, "ERROR: Reason unspecified!");
            new player1;
            new string[128];
            new playername[MAX_PLAYER_NAME];
            new adminname [MAX_PLAYER_NAME];
            player1 = strval(tmp);

            if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (AccInfo[player1][Level] != ServerInfo[MaxAdminLevel]))
            {
                GetPlayerName(player1, playername, sizeof(playername));
                GetPlayerName(playerid, adminname, sizeof(adminname));
                new year,month,day; getdate(year, month, day);
                new hour,minuite,second; gettime(hour,minuite,second);
                SendCommandToAdmins(playerid,"Ban");
                format(string,sizeof(string),"|- %s has been Banned by Administrator %s | Reason: %s [Date: %d/%d/%d] [Time: %d:%d]",playername,adminname,params[2],day,month,year,hour,minuite);
                SendClientMessageToAll(lightred,string);
                new str[128];
                format(str,sizeof(str),"%s has been Banned by Administrator %s | Reason: %s",playername,adminname,params[2]);
                SaveIn("BanLog",str);
                print(string);
                if(udb_Exists(PlayerName2(player1)) && AccInfo[player1][LoggedIn] == 1)
                dUserSetINT(PlayerName2(player1)).("Banned",1);
                format(string,sizeof(string),"Banned by Administrator %s. | Reason: %s",adminname,params[2]);
                return BanEx(player1, string);
            }
            else return SendClientMessage(playerid, red, "ERRPR: Player is not connected or is yourself or is the highest level admin");
        }
        else return ErrorMessages(playerid, 1);
    }
    else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}



Re: Change name ban to ip ban - linuxthefish - 28.05.2011

BanEx is in there, so it should ban the players IP.


Re: Change name ban to ip ban - ColdIce - 28.05.2011

Well it doesnt When they get banned and they relog the server says: "This name is banned".

So they just change name and come back


Re: Change name ban to ip ban - BigETI - 28.05.2011

There is something called "Ban Evading".
That happens when a player gets banned from a server and just changes his/her IP to evade the ban.
Better check the codes at OnPlayerConnect since there should be a system which blocks those ban evading users.
(Best punishment is a system re-ban for ban evading.)


Re: Change name ban to ip ban - Biesmen - 28.05.2011

pawn Код:
new IP[16];
GetPlayerIp(player1, IP, sizeof(IP));
format(string, sizeof(string), "banip %s", IP);
SendRconCommand(string);



Re: Change name ban to ip ban - ColdIce - 28.05.2011

Can u please add it to my code and post it?