Results 1 to 1 of 1
  1. #1
    Senior Member
    Join Date
    Oct 2015
    Location
    Germany
    Posts
    276

    Insane Limits - Air Peace Kicker - recommended for shanghai only servers - BF4

    Insane Limits - Air Peace Kicker - good for shanghai only servers

    Air peace is a typical problem of shanghai only servers.

    Air peace is a very dirty playstyle between two enemy pilots. It means that the chopper in team US dont fight vs the chopper in team RU. The pilots makes a "special air peace agreement" like "i dont kill you and you dont kill me. lets farm infantry kills". Then you have on each team a pilot with an 50 kill streak at the same time. This kind of players likes to make easy kills to push their own stats.

    This limit detect a air peace between two enemy pilots. The detected players will be warned and punished.


    How the limit works?
    The function of the limit is simple. It count a special kill streak of each player. But it counts only the kills with air vehicles. If both teams have a pilot with an high "air kill streak" at the same time, then the detected players will be warned and punished (time ban for 3 hour). It reset the kill streak on a "non air vehicle" kill or when the players was killed / balanced.


    INSTALLATION
    Settings for Insane Limits

    Evaluation: OnKill
    First_check: Code
    First_check_code: put the code here
    limit_action: none


    Code
    Code:
    //////////////////////////////
    // Air Peace Kicker
    // info > insane limits settings: limit_evaluation: OnKill  ;  limit_first_check: Code   ;   limit_action: none
    //////////////////////////////	
    
    // SETTINGS  (you can change this values)
    int minKillStreak = 10;   // <-- IMPORTANT SETTING: set min kill streak (it counts only air vehicle kills)
    int maxWarningKick = 8;   // set max nr. of player warings in a row to kick the player after air peace is confirmed
    bool PutReservedSlotsInWhitelist = false;  // true = no warning messages and no kicks for players with reserved slot
    
    // ADVANCED SETTINGS
    int minPlayers = 5;  // min nr. of players on server to enable limit
    int StopByRemainingTickets = 70;  // disable limit if one team have less than xy tickets left
    bool VirtualTestMode = false; // true = no kick, no ban, no in-game warning. display infos in procon pc tool only
    
    // SETTINGS END
    
    string Virtu = String.Empty;
    int killstreak_air = 0;
    int air_peace_warning = 0;
    bool air_peace_confirmed = false;
    bool vip = false;
    
    if (server.PlayerCount < minPlayers) return false;
    if ((server.RemainTickets(1) < StopByRemainingTickets) || (server.RemainTickets(2) < StopByRemainingTickets)) {return false;}
    if ((PutReservedSlotsInWhitelist) && (plugin.GetReservedSlotsList().Contains(killer.Name))) vip = true;
    if (VirtualTestMode) {Virtu = "^1^bDEBUG^1^n - Virtual Test Mode > ";}
    //if (server.MapFileName != "MP_Siege") {return false;}
    
    
    
    Dictionary<String, int> air_peace_playerlist = new Dictionary<String, int>();
    if (!plugin.RoundData.issetObject("air_peace_players")) plugin.RoundData.setObject("air_peace_players", new Dictionary<String, int>());
    air_peace_playerlist = (Dictionary<String,int>)plugin.RoundData.getObject("air_peace_players");
    
    if (!vip) {
    	if (kill.Category == "VehicleAir") {
    		if (server.RoundData.issetInt("killstreak_air_" + killer.TeamId.ToString() + "_" + killer.Name)) killstreak_air = server.RoundData.getInt("killstreak_air_" + killer.TeamId.ToString() + "_" + killer.Name);
    		if (server.RoundData.issetInt("killstreak_air_" + server.OppositeTeamId(killer.TeamId).ToString() + "_" + killer.Name)) {
    			// reset counter, got balanced
    			server.RoundData.unsetInt("killstreak_air_" + server.OppositeTeamId(killer.TeamId).ToString() + "_" + killer.Name);
    			if (server.RoundData.issetInt("air_peace_warning_" + killer.Name)) server.RoundData.unsetInt("air_peace_warning_" + killer.Name);
    			if (air_peace_playerlist.ContainsKey(killer.Name)) { 
    				air_peace_playerlist.Remove(killer.Name); 
    				plugin.RoundData.setObject("air_peace_players", air_peace_playerlist);
    			}
    			killstreak_air = 0;
    		}
    		killstreak_air++;
    		server.RoundData.setInt("killstreak_air_" + killer.TeamId.ToString() + "_" + killer.Name, killstreak_air);
    		if (killstreak_air == minKillStreak) {
    			if (!air_peace_playerlist.ContainsKey(killer.Name)) {
    				air_peace_playerlist.Add(killer.Name, killer.TeamId);
    				plugin.RoundData.setObject("air_peace_players", air_peace_playerlist);
    			}
    		}
    	} else if (!Regex.Match(kill.Weapon, "(DamageArea|SoldierCollision|Death|RoadKill|VehicleUpsideDown|Suicide)").Success) {
    		if (victim.TeamId != killer.TeamId) {
    			// reset counter
    			if (server.RoundData.issetInt("killstreak_air_" + killer.TeamId.ToString() + "_" + killer.Name)) server.RoundData.unsetInt("killstreak_air_" + killer.TeamId.ToString() + "_" + killer.Name);
    			if (server.RoundData.issetInt("air_peace_warning_" + killer.Name)) server.RoundData.unsetInt("air_peace_warning_" + killer.Name);
    			if (air_peace_playerlist.ContainsKey(killer.Name)) { 
    				air_peace_playerlist.Remove(killer.Name); 
    				plugin.RoundData.setObject("air_peace_players", air_peace_playerlist);
    			}
    			killstreak_air = 0;
    		}
    	}
    }
    
    //reset victim counter
    if (victim.TeamId != killer.TeamId) {
    	if (server.RoundData.issetInt("killstreak_air_" + victim.TeamId.ToString() + "_" + victim.Name)) server.RoundData.unsetInt("killstreak_air_" + victim.TeamId.ToString() + "_" + victim.Name);
    	if (server.RoundData.issetInt("air_peace_warning_" + victim.Name)) server.RoundData.unsetInt("air_peace_warning_" + victim.Name);
    	if (air_peace_playerlist.ContainsKey(victim.Name)) { 
    		air_peace_playerlist.Remove(victim.Name); 
    		plugin.RoundData.setObject("air_peace_players", air_peace_playerlist);
    	}
    }
    
    //check air peace list
    string tmp_players = String.Empty;
    if (air_peace_playerlist.Count >= 2) {
    	if (air_peace_playerlist.ContainsKey(killer.Name)) {
    		if ((air_peace_playerlist.ContainsValue(1)) && (air_peace_playerlist.ContainsValue(2))) {
    			//check if players are still on server
    			foreach (KeyValuePair<String, int> pair in air_peace_playerlist) {
    				if (plugin.BestPlayerMatch(pair.Key) != pair.Key) {
    					air_peace_playerlist.Remove(pair.Key); 
    					if (server.RoundData.issetInt("killstreak_air_1_" + pair.Key)) server.RoundData.unsetInt("killstreak_air_1_" + pair.Key);
    					if (server.RoundData.issetInt("killstreak_air_2_" + pair.Key)) server.RoundData.unsetInt("killstreak_air_2_" + pair.Key);
    					if (server.RoundData.issetInt("air_peace_warning_" + pair.Key)) server.RoundData.unsetInt("air_peace_warning_" + pair.Key);
    					air_peace_playerlist.Remove(pair.Key); 
    					plugin.RoundData.setObject("air_peace_players", air_peace_playerlist);
    					return false;
    				} else {
    					if (tmp_players == String.Empty) {
    						tmp_players += pair.Key + " (Team: " + pair.Value.ToString() + ")";
    					} else {
    						tmp_players += ",  " + pair.Key + "(Team: " + pair.Value.ToString() + ")";
    					}
    				}
    			}
    			air_peace_confirmed = true;
    		}
    	}
    }
    
    
    //warning msg
    if (air_peace_confirmed) {
    	if (server.RoundData.issetInt("air_peace_warning_" + killer.Name)) air_peace_warning = server.RoundData.getInt("air_peace_warning_" + killer.Name);
    	air_peace_warning ++;
    	server.RoundData.setInt("air_peace_warning_" + killer.Name, air_peace_warning);
    	if ((air_peace_warning > maxWarningKick) || (vip)) {
    		//reset
    		server.RoundData.unsetInt("air_peace_warning_" + killer.Name);
    		server.RoundData.unsetInt("killstreak_air_" + killer.TeamId.ToString() + "_" + killer.Name);
    		air_peace_playerlist.Remove(killer.Name);
    		if (vip) return false;
    		//time ban
    		plugin.RoundData.setObject("air_peace_players", air_peace_playerlist);
    		plugin.ConsoleWrite("IL > ^1^bAIR PEACE KICKER:^1^n Confirmed air peace between " + tmp_players);
    		plugin.PRoConChat(Virtu + "IL > ^1^bAIR PEACE KICKER:^1^n " + killer.Name + " KICKED for air peace (map: " + plugin.FriendlyMapName(server.MapFileName) + " - K/D: " + killer.KillsRound.ToString() + "/" + killer.DeathsRound.ToString() + ")");
    		plugin.ConsoleWrite(Virtu + "IL > ^1^bAIR PEACE KICKER:^1^n " + killer.Name + " KICKED for air peace (map: " + plugin.FriendlyMapName(server.MapFileName) + " - K/D: " + killer.KillsRound.ToString() + "/" + killer.DeathsRound.ToString() + ")");
    		if (!VirtualTestMode) plugin.SendGlobalMessage(killer.Name + " was KICKED for air peace");
    		if (!VirtualTestMode) plugin.EABanPlayerWithMessage(EABanType.Name, EABanDuration.Temporary, killer.Name, 180, killer.Name + " > TIME BAN (3 hours) > No air peace! (map: " + plugin.FriendlyMapName(server.MapFileName) + " - K/D: " + killer.KillsRound.ToString() + "/" + killer.DeathsRound.ToString() + ")");
    		return false;
    	}
    	if (air_peace_warning%2 == 1) {
    		string tmp_last_chance = String.Empty;
    		if (air_peace_warning == 1) plugin.PRoConChat("IL > ^1^bAIR PEACE KICKER:^1^n Confirmed air peace between " + tmp_players);
    		if (air_peace_warning + 3 >= maxWarningKick) {tmp_last_chance = " Last warning - next time: KICK";}
    		if (!VirtualTestMode) plugin.SendPlayerYell(killer.Name, "[WARNING]\n" + killer.Name + " air peace is NOT allowed!" + tmp_last_chance, 5);
    		if (!VirtualTestMode) plugin.SendPlayerMessage(killer.Name, killer.Name + " air peace is NOT allowed!" + tmp_last_chance);
    		if (VirtualTestMode) plugin.PRoConChat(Virtu + "PSay > " + killer.Name + " air peace is NOT allowed!" + tmp_last_chance);
    		if (VirtualTestMode) plugin.PRoConChat(Virtu + "PYell > [WARNING] " + killer.Name + " air peace is NOT allowed!" + tmp_last_chance);
    	}
    }

 

 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •