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

    Insane Limits - Switch move players with same CLANTAG in on Team by chat-command

    Insane Limits - Switch/move all players with same CLANTAG in on Team by in-game-chat command (working code)

    This is a easy way to switch all players with the same CLANTAG in on Team automatically. Only players with "Clan-Switch-Privileges" can start this function by typ !clanswitchus <CLANTAG> in the in-game-chat. After that, all players with the <CLANTAG> will be moved on death to the US Team automatically.


    HOW TO USE
    Only players with Clan-Switch-Privileges can start the automatic clan switch function by type "!clanswitchus <CLANTAG>" in the in-game-chat. All players with the <CLANTAG> will be moved on death to the US Team automatically.


    IN-GAME-CHAT COMMANDS
    (only for players with Clan-Switch-Privileges)
    !clanswitchus <CLANTAG>
    !clanswitchru <CLANTAG>
    !clanswitchcn <CLANTAG>
    !clanswitch off



    INSTALLATION
    Go to the INSANE LIMITS plugin and create two new LIMITS.
    Setup Limit#1 (dont forget to setup the playerlist with Clan-Switch-Privileges)
    Setup Limit#2 (dont forget to change your serverslots)



    SETUP LIMIT#1
    limit_evaluation: OnAnyChat
    limit_first_check: Code
    limit_first_check_code: paste the CODE#1 here

    CODE#1:
    Code:
    // IMPORTANT: You have to setup the bf4 playernames with Clan-Switch-Privileges (admins, vips). Put the playernames in this list:
    if (Regex.Match(player.Name, @"(?:SuperSniper|BigBoyBerlin|TopCamper0815)", RegexOptions.IgnoreCase).Success) return true;
    
    // HOW TO USE:    type !clanswitchus <CLANTAG>   in the bf4 in-game-chat to switch all Clan-Players to the US Team.
    //             or type !clanswitchru <CLANTAG>   in the bf4 in-game-chat to switch all Clan-Players to the RU Team.
    //             or type !clanswitchcn <CLANTAG>   in the bf4 in-game-chat to switch all Clan-Players to the CN Team.
    //             or type !clanswitch off           in the bf4 in-game-chat to stop the automatic clan switch.
    ENABLE SECOND CHECK
    limit_second_check: Code
    limit_second_check_code: paste the CODE#2 here

    CODE#2
    Code:
    int TmpTeam = 6;
    String TmpTeamName = "";
    String TmpClanTag = "";
    String GetGlobalTAG = "";
    
    Match USclanswitch = Regex.Match(player.LastChat, @"^\s*!clanswitchus\s+([^\s]+)", RegexOptions.IgnoreCase);
    Match RUclanswitch = Regex.Match(player.LastChat, @"^\s*!clanswitchru\s+([^\s]+)", RegexOptions.IgnoreCase);
    Match CNclanswitch = Regex.Match(player.LastChat, @"^\s*!clanswitchcn\s+([^\s]+)", RegexOptions.IgnoreCase);
    Match clanswitchOFF = Regex.Match(player.LastChat, @"^\s*!clanswitch\s+([^\s]+)", RegexOptions.IgnoreCase); // ClanSwitch off
    
    if (USclanswitch.Success) {TmpClanTag = USclanswitch.Groups[1].Value; TmpTeam = 0; TmpTeamName = "US";}
    if (RUclanswitch.Success) {TmpClanTag = RUclanswitch.Groups[1].Value; TmpTeam = 1; TmpTeamName = "RU";}
    if (CNclanswitch.Success) {TmpClanTag = CNclanswitch.Groups[1].Value; TmpTeam = 2; TmpTeamName = "CN";}
    if (clanswitchOFF.Success) {TmpClanTag = "OFFCommand";} // ClanSwitch off
    
    if (TmpClanTag.Length == 0) return false;
    // ClanSwitch off command
    if (TmpClanTag == "OFFCommand") {server.Data.setString("GlobalClan2Switch", "OFFCommand"); plugin.ConsoleWrite("ClanSwitch OFF"); plugin.SendGlobalMessage("BALANCER: Clan Switch OFF"); return false;} // Clan-Switch off
    
    // Start the Clan Swich
    if (server.Data.issetString("GlobalClan2Switch")) GetGlobalTAG = server.Data.getString("GlobalClan2Switch");
    server.Data.setString("GlobalClan2Switch", TmpClanTag);
    plugin.ConsoleWrite("ClanSwitch ON ---- Switch all Clan [" + TmpClanTag + "] Players to Team " + TmpTeamName);
    plugin.SendGlobalMessage("BALANCER: Switch all Clan [" + TmpClanTag + "] Players to Team " + TmpTeamName);
    
    int GetGlobalTeam = TmpTeam;
    if (server.Data.issetInt("GlobalSwitch2Team")) GetGlobalTeam = server.Data.getInt("GlobalSwitch2Team");
    server.Data.setInt("GlobalSwitch2Team", TmpTeam);


    SETUP LIMIT#2
    limit_evaluation: OnDeath
    limit_first_check: Code
    limit_first_check_code: paste the CODE#3 here

    CODE#3
    Code:
    int ServerSlots = 16; // IMPORTANT: PUT THE SERVERSLOTS HERE
    String Global2 = "OFFCommand";
    
    // Match clanswitch = Regex.Match(player.LastChat, @"^\s*!aa\s+([^\s]+)", RegexOptions.IgnoreCase);
    // if (!clanswitch.Success) return false;
    
    if (player.Tag.Length == 0) return false;
    if (server.Data.issetString("GlobalClan2Switch")) Global2 = server.Data.getString("GlobalClan2Switch");
    if (Global2.Length == 0) return false;
    if (Global2 == "OFFCommand") return false;
    
    if (player.Tag == Global2) {
    	int Global3 = 5;
    	if (server.Data.issetInt("GlobalSwitch2Team")) Global3 = server.Data.getInt("GlobalSwitch2Team");
    	if (server.GetFaction(server.OppositeTeamId(player.TeamId)) == Global3) {
    		if (server.PlayerCount < ServerSlots) {
    			plugin.ConsoleWrite("ClanSwitch " + player.Name + " was moved");
    			plugin.SendGlobalMessage("BALANCER: " + player.Name + " was moved by Clan Switch");
    			plugin.ServerCommand("admin.movePlayer", player.Name, server.OppositeTeamId(player.TeamId).ToString(), "9", "true");
    		}	
    	}
    }

  2. #2
    Senior Member
    Join Date
    Nov 2011
    Location
    Germany
    Posts
    154
    only works with free slots at target team. otherwise good work

  3. #3
    Senior Member
    Join Date
    Jul 2014
    Location
    Alabama
    Posts
    253
    Mine would be "int ServerSlots = 32;"

    But what do you mean by free slots at target team?

  4. #4
    Senior Member
    Join Date
    Oct 2015
    Location
    Germany
    Posts
    292
    @Grovax:
    thanks


    @Mamba334:
    it means that the clan-switcher can only swich when your server is not full. for exemple: you have a server with 32 slots and all slots are in use (32 players are playing) than its not possible to switch players. you need a free slot at target team...

  5. #5
    Senior Member
    Join Date
    Jul 2014
    Location
    Alabama
    Posts
    253
    Oh ok, so basically this would be better for clan matches?

  6. #6
    Quote Originally Posted by Mamba334 View Post
    Oh ok, so basically this would be better for clan matches?
    That's what i believe it was originally intended for, yes.
    ____

 

 

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
  •