OMG, Ban help [Help me] ;( ;(
#1

When i tried. To ban a player.. It bans players and IP right?

Then when a new player from other country come they saying they are banned.

I dont really know why. Even if they IP is not same in ban

Need Help please

OnPlayerConnect
Код:
	new string[128];
	new playerip[32];
	GetPlayerIp(playerid, playerip, sizeof(playerip));
	new szPlayerIP[16];
	new ip[128];
	GetPlayerIp(playerid, szPlayerIP, sizeof(szPlayerIP));
	GetPlayerIp(playerid,ip,sizeof(ip));

	if(PlayerInfo[playerid][pBanned] >= 1 || PlayerInfo[playerid][pPermaBanned] >= 1 || CheckBan(szPlayerIP) >= 1)
	{
		format(string, sizeof(string), "WARNING: %s (IP:%s) tried to login whilst banned and has been auto-banned.", GetPlayerNameEx(playerid), PlayerInfo[playerid][pIP]);
		ABroadCast(COLOR_YELLOW, string, 1);
		AddBan(ip);
		Log("logs/ban.log", string);
		SetPlayerName(playerid, "BannedPlayer");
		SendClientMessage(playerid, COLOR_REALRED, "If you are permanently banned that means you cannot appeal anymore!!!");
		KickWithMessage(playerid, COLOR_REALRED,  "You are banned from Philippines Roleplay. You may appeal this ban at "WEBSITE"");
		return 1;
	}
Ban/Banip/oBan
Код:
CMD:ban(playerid, params[])
{
	if(CheckGMX(playerid)) return 1;
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new string[128], giveplayerid, reason[64];
        if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid/partofname] [reason]");

        if(IsPlayerConnected(giveplayerid))
        {
            if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
            {
                if(AdminDuty[playerid] == 1)
                {
                    new username[MAX_PLAYER_NAME];
                    GetPVarString(playerid, "TempNameName", username, sizeof(username));
                    SetPVarInt(playerid, "TempName", 0);
                    SetPlayerName(playerid, username);
                }
                format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", PlayerInfo[playerid][pAdminName]);
                ABroadCast(COLOR_YELLOW,string,1);
                PlayerInfo[playerid][pBanned] = 1;
                new ip[32], cw[64], tstring[128], year, month, day, hour, minute, second;
                GetPlayerIp(playerid,ip,sizeof(ip));
                AddBan(ip);
                getdate(year, month, day);
                gettime(hour, minute, second);
                format(tstring, sizeof(tstring), "Date/Time: %i/%i/%i, %i:%i:%i", day, month, year, hour, minute, second);
				format(cw, sizeof(cw), "Current Warnings: %i (3 for Ban)", PlayerInfo[playerid][pWarns]);
				ABroadCast(COLOR_LIGHTRED, string, 1);
                SendClientMessage(playerid, COLOR_REALRED, "--------------------- Ban Report ---------------------");
                SendClientMessage(playerid, COLOR_WHITE, cw);
                SendClientMessage(playerid, COLOR_WHITE, "Staff: Server");
                SendClientMessage(playerid, COLOR_WHITE, "Reason: Tried to ban a higher admin");
                SendClientMessage(playerid, COLOR_WHITE, tstring);
                SendClientMessage(playerid, COLOR_REALRED, "Make sure you have the Screenshot of this ban by pressing (F8)");
                SendClientMessage(playerid, COLOR_REALRED, "Feel free to post a ban appeal at "WEBSITE". Have a nice day!");
                SendClientMessage(playerid, COLOR_REALRED, "-------------------------------------------------------");
                KickWithMessage(playerid, COLOR_REALRED, "Your Banned from Philippines Roleplay");

                return 1;
            }
            else
            {
                new playerip[32];
                GetPlayerIp(giveplayerid, playerip, sizeof(playerip));

                if(AdminDuty[giveplayerid] == 1)
                {
                  	new username[MAX_PLAYER_NAME];
                    GetPVarString(giveplayerid, "TempNameName", username, sizeof(username));
                    SetPVarInt(giveplayerid, "TempName", 0);
                    SetPlayerName(giveplayerid, username);

           
                    format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s",  GetPlayerNameEx(giveplayerid),playerip, PlayerInfo[playerid][pAdminName], reason);
                    Log("logs/ban.log", string);
                    format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s",  GetPlayerNameEx(giveplayerid), PlayerInfo[playerid][pAdminName], reason);
                }
                else
                {
                    format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), playerip, PlayerInfo[playerid][pAdminName], reason);
                    Log("logs/ban.log", string);
                    format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), PlayerInfo[playerid][pAdminName], reason);
                }


         
                ABroadCast(COLOR_LIGHTRED, string, 1);
                PlayerInfo[giveplayerid][pBanned] = 1;
                new ip[32];
                GetPlayerIp(giveplayerid,ip,sizeof(ip));
                AddBan(ip);
                new cw[64], tstring[128], sstring[128], rstring[128], aname[pAdminName], year, month, day, hour, minute, second;
                GetPlayerName(playerid, aname, sizeof(aname));
                getdate(year, month, day);
                gettime(hour, minute, second);
                format(tstring, sizeof(tstring), "Date/Time: %i/%i/%i, %i:%i:%i", day, month, year, hour, minute, second);
                format(sstring, sizeof(sstring), "Staff: %s", PlayerInfo[playerid][pAdminName]);
                format(rstring, sizeof(rstring), "Reason: %s", reason);
				format(cw, sizeof(cw), "Current Warnings: %i (3 for Ban)", PlayerInfo[giveplayerid][pWarns]);
                SendClientMessage(giveplayerid, COLOR_REALRED, "--------------------- Ban Report ---------------------");
                SendClientMessage(giveplayerid, COLOR_WHITE, cw);
                SendClientMessage(giveplayerid, COLOR_WHITE, sstring);
                SendClientMessage(giveplayerid, COLOR_WHITE, rstring);
                SendClientMessage(giveplayerid, COLOR_WHITE, tstring);
                SendClientMessage(giveplayerid, COLOR_REALRED, "Make sure you have the Screenshot of this ban by pressing (F8)");
                KickWithMessage(giveplayerid, COLOR_REALRED, "Feel free to post a ban appeal at ["WEBSITE"]");
                

     			return 1;
            }

        } else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
    }
    return 1;
}
Код:
CMD:oban(playerid, params[])
{
	if(CheckGMX(playerid)) return 1;
	if(PlayerInfo[playerid][pAdmin] < 3)
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
		return 1;
	}
 	if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
  	{
   		SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
		return 1;
	}

	new string[128], playername[MAX_PLAYER_NAME], reason[64];
	if(sscanf(params, "s[MAX_PLAYER_NAME]s[64]", playername, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /oban [playername] [reason]");

    new giveplayerid = ReturnUser(playername);
	if(IsPlayerConnected(giveplayerid))
	{
		SendClientMessage(playerid, COLOR_GRAD2, "That player is online, use /ban for online players.");
	}
	else if(doesAccountExist(playername))
	{
		OnPlayerOfflineLogin(playername);
		if(PlayerInfo[MAX_PLAYERS][pPermaBanned] == 1)
		{
			SendClientMessage(playerid, COLOR_WHITE, "That player is already permabanned!");
			return 1;
		}
		if(PlayerInfo[MAX_PLAYERS][pAdmin] >= 1)
		{
			SendClientMessage(playerid, COLOR_WHITE, "You can't ban admin accounts!");
			return 1;
		}
		else
		{
			if(PlayerInfo[MAX_PLAYERS][pBanned] >= 0)
			{
				PlayerInfo[MAX_PLAYERS][pBanned] = 1;
				AddBan(PlayerInfo[MAX_PLAYERS][pIP]);
				OnPlayerOfflineSave(playername);
				format(string, sizeof(string), "AdmCmd: %s (IP:%s) was offline banned by %s, reason: %s", playername, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid), reason);
				Log("logs/ban.log", string);
				format(string, 128, "AdmCmd: %s (IP:%s) was offline banned by %s, reason: %s", playername, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid), reason);
				ABroadCast(COLOR_LIGHTRED,string,1);
			}
			else
			{
				SendClientMessage(playerid, COLOR_WHITE, "That player is already banned!");
			}
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, "That account doesn't exist.");
	}
	return 1;
}
Код:
CMD:banip(playerid, params[])
{
	if(CheckGMX(playerid)) return 1;
	if(IsPlayerConnected(playerid)) {
	    new string[128], tmp[32];
		if(sscanf(params, "s[32]", tmp)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /banip [ip]");
        if(AdminDuty[playerid] == 0) return SendClientMessage(playerid, -1, "You must be ( /aduty ) to use this Command!");
		if(PlayerInfo[playerid][pAdmin] >= 4) {
			AddBan(tmp);
			format(string, sizeof(string), "ADMCMD: %s has banned IP:%s", GetPlayerNameEx(playerid), tmp);
			ABroadCast(COLOR_LIGHTRED,string,1);
		} else {
  			SendClientMessage(playerid, COLOR_GRAD2, "   You are not authorized to use that command !");
		}
	}
	return 1;
}
Permanent Banned
Код:
CMD:permaban(playerid, params[])
{
	if(CheckGMX(playerid)) return 1;
	if(PlayerInfo[playerid][pAdmin] > 4)
	{
		new string[128], giveplayerid, reason[64];
		if(sscanf(params, "us[64]", giveplayerid, reason))
		{
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /permaban [playerid/partofname] [reason]");
			return 1;
		}

		if(IsPlayerConnected(giveplayerid))
		{
			if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
			{
				if(AdminDuty[playerid] == 1)
				{
					new username[MAX_PLAYER_NAME];
					GetPVarString(playerid, "TempNameName", username, sizeof(username));
					SetPVarInt(playerid, "TempName", 0);
					SetPlayerName(playerid, username);
				}
  				format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /permaban a higher admin.", PlayerInfo[playerid][pAdminName]);
                ABroadCast(COLOR_YELLOW,string,1);
                PlayerInfo[playerid][pPermaBanned] = 1;
                new ip[32], cw[64], tstring[128], year, month, day, hour, minute, second;
                GetPlayerIp(playerid,ip,sizeof(ip));
                AddBan(ip);
                getdate(year, month, day);
                gettime(hour, minute, second);
                format(tstring, sizeof(tstring), "Date/Time: %i/%i/%i, %i:%i:%i", day, month, year, hour, minute, second);
				format(cw, sizeof(cw), "Current Warnings: %i (3 for Ban)", PlayerInfo[playerid][pWarns]);
				ABroadCast(COLOR_LIGHTRED, string, 1);
                SendClientMessage(playerid, COLOR_REALRED, "--------------------- Permanent Ban Report ---------------------");
                SendClientMessage(playerid, COLOR_WHITE, cw);
                SendClientMessage(playerid, COLOR_WHITE, "Staff: Server");
                SendClientMessage(playerid, COLOR_WHITE, "Reason: Tried to ban a higher admin");
                SendClientMessage(playerid, COLOR_WHITE, tstring);
                SendClientMessage(playerid, COLOR_REALRED, "This ban cannot be appeal anymore.");
                SendClientMessage(playerid, COLOR_REALRED, "Only the server owner can decide if he will unban.");
                SendClientMessage(playerid, COLOR_REALRED, "If you feel this ban is unfair contact Ivann at skype: christianivann09");
                SendClientMessage(playerid, COLOR_REALRED, "-------------------------------------------------------");
                KickWithMessage(playerid, COLOR_REALRED, "Say good bye to Philippines Roleplay Mate.");

			}
			else
			{
				new playerip[32];
				GetPlayerIp(giveplayerid, playerip, sizeof(playerip));

				if(AdminDuty[giveplayerid] == 1)
				{
					new username[MAX_PLAYER_NAME];
					GetPVarString(giveplayerid, "TempNameName", username, sizeof(username));
					SetPVarInt(giveplayerid, "TempName", 0);
					SetPlayerName(giveplayerid, username);

					format(string, sizeof(string), "AdmCmd: %s(IP:%s) was permanently banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], playerip, GetPlayerNameEx(playerid), reason);
					Log("logs/ban.log", string);
					format(string, sizeof(string), "AdmCmd: %s was permanently banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], GetPlayerNameEx(playerid), reason);
				}
				else
				{
					format(string, sizeof(string), "AdmCmd: %s(IP:%s) was permanently banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason);
					Log("logs/ban.log", string);
					format(string, sizeof(string), "AdmCmd: %s was permanently banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
				}
         
                ABroadCast(COLOR_LIGHTRED, string, 1);
                PlayerInfo[giveplayerid][pPermaBanned] = 1;
                new ip[32];
                GetPlayerIp(giveplayerid,ip,sizeof(ip));
                AddBan(ip);
                new cw[64], tstring[128], sstring[128], rstring[128], aname[pAdminName], year, month, day, hour, minute, second;
                GetPlayerName(playerid, aname, sizeof(aname));
                getdate(year, month, day);
                gettime(hour, minute, second);
                format(tstring, sizeof(tstring), "Date/Time: %i/%i/%i, %i:%i:%i", day, month, year, hour, minute, second);
                format(sstring, sizeof(sstring), "Staff: %s", PlayerInfo[playerid][pAdminName]);
                format(rstring, sizeof(rstring), "Reason: %s", reason);
				format(cw, sizeof(cw), "Current Warnings: %i (3 for Ban)", PlayerInfo[giveplayerid][pWarns]);
                SendClientMessage(giveplayerid, COLOR_REALRED, "--------------------- PermanentBan Report ---------------------");
                SendClientMessage(giveplayerid, COLOR_WHITE, cw);
                SendClientMessage(giveplayerid, COLOR_WHITE, sstring);
                SendClientMessage(giveplayerid, COLOR_WHITE, rstring);
                SendClientMessage(giveplayerid, COLOR_WHITE, tstring);
                SendClientMessage(playerid, COLOR_REALRED, "This ban cannot be appeal anymore.");
                SendClientMessage(playerid, COLOR_REALRED, "Only the server owner can decide if he will unban.");
                SendClientMessage(playerid, COLOR_REALRED, "If you feel this ban is unfair contact Ivann at skype: christianivann09");
                SendClientMessage(playerid, COLOR_REALRED, "-------------------------------------------------------");
                KickWithMessage(playerid, COLOR_REALRED, "Say good bye to Philippines Roleplay Mate.");

			}
			return 1;
		}
	}
	else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
	return 1;
}
THANK YOU SO MUCH FOR HELPING GUYS!
Reply
#2

Show AddBan stock. I think you're banning IP on each of these commands..
Reply
#3

Quote:
Originally Posted by LocMax
Посмотреть сообщение
Show AddBan stock. I think you're banning IP on each of these commands..
Код:
stock AddBan(ip[])
{
	if(CheckBan(ip) == 0)
	{
		new File: file = fopen("ban.cfg", io_append);
		new string[20];
		format(string, sizeof(string), "\n%s", ip);
	 	fwrite(file, string);
	 	fclose(file);
		return 1;
	}
	return 0;
}
Код:
stock RemoveBan(ip[])
{
    if(CheckBan(ip) == 1)
	{
	    new string[20];
		new File: file = fopen("ban.cfg", io_read);
		fcreate("tempBan.cfg");
		new File: file2 = fopen("tempBan.cfg", io_append);
		while(fread(file, string))
		{
			if(strcmp(ip, string, true, strlen(ip)) != 0 && strcmp("\n", string) != 0)
		    {
				fwrite(file2, string);
			}
		}
		fclose(file);
		fclose(file2);
		file = fopen("ban.cfg", io_write);
		file2 = fopen("tempBan.cfg", io_read);
		while(fread(file2, string))
		{
			fwrite(file, string);
		}
		fclose(file);
		fclose(file2);
		fremove("tempBan.cfg");
		return 1;
    }
	return 0;
}
Reply
#4

Whats the problem of it guys?
Reply
#5

Enter in your ban.cfg and delete all IP's
Reply
#6

show the stock of this CheckBan(szPlayerIP)
Reply
#7

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
show the stock of this CheckBan(szPlayerIP)
Its not found. But i think its CheckBan(ip)

Код:
stock CheckBan(ip[])
{
	new string[20];
    new File: file = fopen("ban.cfg", io_read);
	while(fread(file, string))
	{
	    if(strcmp(ip, string, true, strlen(ip)) == 0)
	    {
	        fclose(file);
	        return 1;
	    }
	}
	fclose(file);
	return 0;
}
Reply
#8

@BroZeus

Whats the problem?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)