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

    BF4 Auto Squad Joiner - Squad Enforcer for Non Squad players - code for Insane limits

    BF4 Auto Squad Joiner - Squad Enforcer for Non Squad players - Insane limits (working code)


    DESCRIPTION
    this code move non squad players into a squad automatically. it move the player on death event into a squad, if they are not already in a squad.

    the code make a new squad if all squads are full. if a player leave a squad they will be move again on death event .


    INFO
    - it is not recommended to change OnDeath to OnJoin. do not change this. because the balancers do their job in this time.
    - it works with all server sizes
    - works with every game modus (conquest, tdm, rush, domination, ...)
    - works for bf4


    SETTINGS FOR INSANE LIMITS
    EVALUATION: OnDeath
    FIRST_CHECK: Code
    FIRST_CHECK_CODE: (put the code here)

    CODE FOR INSANE LIMITS

    Code:
    // AUTO SQUAD JOINER - MOVE NON-SQUAD-PLAYERS AUTOMATICALLY IN A SQUAD  -  by maxdralle
    
    // CHECK PLAYER - IN SQUAD OR NON SQUAD
    if (player.SquadId == 0) {
    // GET SQUAD LIST
    	List<PlayerInfoInterface> players = new List<PlayerInfoInterface>();
    	if (player.TeamId == 1) players.AddRange(team1.players);
    	if (player.TeamId == 2) players.AddRange(team2.players);
    	if (player.TeamId == 3) players.AddRange(team3.players);
    	if (player.TeamId == 4) players.AddRange(team4.players);
    	Dictionary<int, int> squadID_Size = new Dictionary<int, int>();
    	foreach(PlayerInfoInterface player_info in players) {
    		int tmpINT44 = Convert.ToInt32(player_info.TeamId.ToString() + player_info.SquadId.ToString());
    		if (!squadID_Size.ContainsKey(tmpINT44))
    			squadID_Size.Add(tmpINT44, 0);
    		squadID_Size[tmpINT44] += 1;
    	}
    
    // CHECK SQUAD SIZE
    	int FreeSquad = 0;
    	for (int TmpsquadID = 1; TmpsquadID < 12; TmpsquadID++) {
    		int tmpListID = Convert.ToInt32(player.TeamId.ToString() + TmpsquadID.ToString());
    		if (!squadID_Size.ContainsKey(tmpListID) && FreeSquad == 0) FreeSquad = TmpsquadID;
    		if (squadID_Size.ContainsKey(tmpListID) && squadID_Size[tmpListID] < 4) FreeSquad = TmpsquadID;
    }
    
    // MOVE PLAYER IN SQUAD + UNLOCK PRIVATE SQUAD
    	if (FreeSquad != 0) { 
    		if (plugin.IsSquadLocked(player.TeamId, FreeSquad)) { plugin.ServerCommand("squad.private", player.TeamId.ToString(), FreeSquad.ToString(), "false"); }
    		plugin.ServerCommand("admin.movePlayer", player.Name, player.TeamId.ToString(), FreeSquad.ToString(), "true");
    		plugin.SendPlayerMessage(player.Name, plugin.R("AUTO SQUAD JOINER: Move " + player.Name + " in Squad"));
    		//plugin.ConsoleWrite("^1^bAUTO SQUAD JOINER^0^n: [" + player.Tag + "] " + player.Name + " moved is Squad - TeamID: " + player.TeamId.ToString() + " SquadID: " + FreeSquad.ToString());
    	}
    }
    Last edited by maxdralle; 14-02-2016 at 15:07.

  2. #2
    Nice!

    It works fine. THX

  3. #3
    Nice, I will check this out.

 

 

Posting Permissions

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