Making a accurate ban system [HELP]
#1

Alright, i've been scripting a ban system and it works well, I am using this ban system to my Weapon Hack Anti-Cheat and it works great, Now, the thing i really want to improve to this system is the ban evading checking, the Check_Ban function object is not enough for me as it only reads the Banned var of the Player's account instead of checking the IP if it is banned.

Codes:

pawn Код:
stock Check_Ban(playerid)
{
    new string[2500];
    if(fexist(UserPath(playerid)))
    {
        pInfo[playerid][Banned] = dini_Int(UserPath(playerid), "Banned");
        format(pInfo[playerid][BanBy], 256, "%s", dini_Get(UserPath(playerid), "BanBy"));
        format(pInfo[playerid][BanReason], 256, "%s", dini_Get(UserPath(playerid), "BanReason"));
        format(pInfo[playerid][WhenBan], 256, "%s", dini_Get(UserPath(playerid), "WhenBan"));
        if(pInfo[playerid][Banned] == 1)
        {
            ClearBox(playerid);
       
            format(string, sizeof(string), ""grey"Sorry, But you are banned from San Andreas Chaos.\nBan Details:\n\n"red"Banned by "white"%s\n"red"Ban Reason "white"(%s)\n"red"Date "white"(%s)\n\n"grey"If you think it is a false ban, Please refer to "#SERVER_URL" and file a ban appeal.\nMake sure to take a screenshot of this (Press F8).", pInfo[playerid][BanBy], pInfo[playerid][BanReason], pInfo[playerid][WhenBan]);
            ShowPlayerDialog(playerid, DIALOG_BANS, DIALOG_STYLE_MSGBOX, ""red"Banned from SAC", string, "Close", "");
            SendClientMessage(playerid, COLOR_RED, "You are banned from the server.");
            format(string, sizeof(string), "Banned by: "white"%s, "red"Reason: "white"%s, "red"When: "white"%s", pInfo[playerid][BanBy], pInfo[playerid][BanReason], pInfo[playerid][WhenBan]);
            SendClientMessage(playerid, COLOR_RED, string);
            SendClientMessage(playerid, -1, "You have been kicked.");
            KickX(playerid);
            return 0;
        }
    }
    return 1;
}
stock AddBan(playerid = -1, targetid, reason[])
{
    new band, bany, banm;
    getdate(bany, banm, band);
    new string[190];

    if(playerid != -1)
    {
        if(fexist(UserPath(targetid)))
        {
            if(logged[targetid] == 1)
            {
                format(pInfo[targetid][BanBy], 256, "%s", GetName(playerid));
                format(pInfo[targetid][BanReason], 256, "%s", reason);
                format(pInfo[targetid][WhenBan], 256, "%d-%d-%d", banm, band, bany);

                ClearBox(targetid, 100);

                format(string, sizeof(string), "** "red"%s has been banned from the server by %s (%s)", GetName(targetid), GetName(playerid), reason);
                SendClientMessageToAll(-1, string);
               
                format(string, sizeof(string), "%s %s banned %s for %s (%s) (IP: %s)", GetA_Rank(playerid), GetName(playerid), GetName(targetid), reason, pInfo[targetid][WhenBan], GetIP(targetid));
                SaveLog("banlog", string);
               
                format(string, sizeof(string), "** "red"You have been banned from the server by %s for %s (%s)", GetName(playerid), reason, pInfo[targetid][WhenBan]);
                SendClientMessage(targetid, -1, string);
               
                SendClientMessage(targetid, -1, "If you think this is a wrongful ban, Visit us at "#SERVER_URL" and file a ban appeal.");
                SendClientMessage(targetid, -1, "Make sure to screenshot this ban for evidence. (Press F8 to take a screenshot)");
               
                pInfo[targetid][Banned] = 1;
               
                KickX(targetid);
            }
        }
    }
    else if(playerid == -1)
    {
        if(fexist(UserPath(targetid)))
        {
            if(logged[targetid] == 1)
            {
                format(pInfo[targetid][BanBy], 256, "Anticheat");
                format(pInfo[targetid][BanReason], 256, "%s", reason);
                format(pInfo[targetid][WhenBan], 256, "%d-%d-%d", banm, band, bany);

                ClearBox(playerid, 100);

                format(string, sizeof(string), "** "red"%s has been banned from the server by the Anticheat (%s)", GetName(targetid), reason);
                SendClientMessageToAll(-1, string);

                format(string, sizeof(string), "Anticheat banned %s for %s (%s) (IP: %s)", GetName(targetid), reason, pInfo[targetid][WhenBan], GetIP(targetid));
                SaveLog("banlog", string);

                format(string, sizeof(string), "** "red"You have been banned from the server by the Anticheat for %s (%s)", reason, pInfo[targetid][WhenBan]);
                SendClientMessage(targetid, -1, string);

                SendClientMessage(targetid, -1, "If you think this is a wrongful ban, Visit us at "#SERVER_URL" and file a ban appeal.");
                SendClientMessage(targetid, -1, "Make sure to screenshot this ban for evidence. (Press F8 to take a screenshot)");

                KickX(targetid);
            }
        }
    }
    return 1;
}
Now, the thing i want to improve here is that to ban the IP as-well adding it to a file, then if the player connects, it checks if the account is banned through Check_Ban, if it is not banned, we will move in checking if the IP matches on the banned IP, if it is banned then we will ban the IP including the account. For the unban, I also need help on removing the IP from the banned list if the player is unbanned .

Help me brothers.
Reply


Messages In This Thread
Making a accurate ban system [HELP] - by JaKe Elite - 01.09.2014, 05:40
Re: Making a accurate ban system [HELP] - by DaniceMcHarley - 01.09.2014, 09:43
Re: Making a accurate ban system [HELP] - by JaKe Elite - 01.09.2014, 10:12
Re: Making a accurate ban system [HELP] - by DaniceMcHarley - 01.09.2014, 10:44
Re: Making a accurate ban system [HELP] - by JaKe Elite - 02.09.2014, 08:35
Re: Making a accurate ban system [HELP] - by PMH - 02.09.2014, 08:39
Re: Making a accurate ban system [HELP] - by Stinged - 02.09.2014, 08:41
Re: Making a accurate ban system [HELP] - by PMH - 02.09.2014, 08:51
Re: Making a accurate ban system [HELP] - by Stinged - 02.09.2014, 08:55

Forum Jump:


Users browsing this thread: 1 Guest(s)