Jump to content

Big thread of Insane Limits scripts


Bartis11313

Recommended Posts

Custom settings on round over

This allows you to use custom tickrate/tickets per game mode or per map, the code has all in one to see examples

first check - Code

evaluation - OnRoundOver

int tickets = 100;
int health = 100;
int delay = 100;
int bleed = 100;
int tickrate = 40;

plugin.ServerCommand ("vars.soldierHealth", health.ToString ());
plugin.ServerCommand ("vars.vehicleSpawnDelay", delay.ToString ());
plugin.ServerCommand ("vars.ticketBleedRate", bleed.ToString ());
plugin.PRoConChat ("^bRestarted values");
plugin.ConsoleWrite ("^bRestarted values");

Thread scriptdelay = new Thread (new ThreadStart (delegate {
    Thread.Sleep (3 * 1000);
    if (server.NextMapFileName == "MP_Prison") { //tickrate per map
        tickrate = 60;

        plugin.ServerCommand ("vars.OutHighFrequency", tickrate.ToString ());
        plugin.PRoConChat ("^bNext map: [^2" + plugin.FriendlyMapName (server.NextMapFileName) + "^0<> ^3" + plugin.FriendlyModeName (server.NextGamemode) + "^0] | Tickrate: [^4" + tickrate + "Hz]");
        plugin.ConsoleWrite ("^bNext map: [^2" + plugin.FriendlyMapName (server.NextMapFileName) + "^0<> ^3" + plugin.FriendlyModeName (server.NextGamemode) + "^0] | Tickrate: [^4" + tickrate + "Hz]");
    } else {
        tickrate = 40;
        plugin.ServerCommand ("vars.OutHighFrequency", tickrate.ToString ());
        plugin.PRoConChat ("^bNext map: [^2" + plugin.FriendlyMapName (server.NextMapFileName) + "^0<> ^3" + plugin.FriendlyModeName (server.NextGamemode) + "^0] | Tickrate: [^4" + tickrate + "Hz]");
        plugin.ConsoleWrite ("^bNext map: [^2" + plugin.FriendlyMapName (server.NextMapFileName) + "^0<> ^3" + plugin.FriendlyModeName (server.NextGamemode) + "^0] | Tickrate: [^4" + tickrate + "Hz]");
    }

    Thread.Sleep (5 * 1000);

    if (server.NextGamemode == "ConquestLarge0") { //CQL
        tickets = 125;

        plugin.ServerCommand ("vars.serverName");
        plugin.ServerCommand ("vars.gameModeCounter", tickets.ToString ());
        plugin.PRoConChat ("^bNext map: [^2" + plugin.FriendlyMapName (server.NextMapFileName) + "^0<> ^3" + plugin.FriendlyModeName (server.NextGamemode) + "^0] | Tickets: " + (tickets * 8).ToString ("F0") + " [^4" + tickets + "^0%]");
        plugin.ConsoleWrite ("^bNext map: [^2" + plugin.FriendlyMapName (server.NextMapFileName) + "^0<> ^3" + plugin.FriendlyModeName (server.NextGamemode) + "^0] | Tickets: " + (tickets * 8).ToString ("F0") + " [^4" + tickets + "^0%]");
    }

    if (server.NextGamemode == "RushLarge0") { //RUSH
        if (server.PlayerCount <= 29) {
            tickets = 150;
        }
        if ((server.PlayerCount >= 30) && (server.PlayerCount <= 44)) {
            tickets = 215;
        }
        if (server.PlayerCount >= 45) {
            tickets = 300;
        }
        plugin.ServerCommand ("vars.serverName");
        plugin.ServerCommand ("vars.gameModeCounter", tickets.ToString ());
        plugin.PRoConChat ("^bNext map: [^2" + plugin.FriendlyMapName (server.NextMapFileName) + "^0<> ^3" + plugin.FriendlyModeName (server.NextGamemode) + "^0] | Tickets: [^4" + tickets + "^0%]");
        plugin.ConsoleWrite ("^bNext map: [^2" + plugin.FriendlyMapName (server.NextMapFileName) + "^0<> ^3" + plugin.FriendlyModeName (server.NextGamemode) + "^0] | Tickets: [^4" + tickets + "^0%]");
    }

    if (server.NextGamemode == "ConquestSmall0") { //CQS
        tickets = 150;
        plugin.ServerCommand ("vars.serverName");
        plugin.ServerCommand ("vars.gameModeCounter", tickets.ToString ());
    }

}));
scriptdelay.Name = "ScriptDelay";
scriptdelay.Start ();

return false;

 

Another script: Custom map by command
Usage is simple, use simple regex I have put in the code so: !map dawn cql = accept (next map is Dawnbreaker with Conquest Large 1 round)
Special case: !map dawn cql 2 = accept (next map is Dawnbreaker with Conquest Large 2 rounds)
You may find it useful on servers without votemap, votemap can trigger the change ! So be aware of it and if you use votemap then write the command after the vote is done
REMEMBER !!!
Use code below map stuff for const index number to don't make your index from 10 to 20 for example... 
 

First code: map command

first check - Code

evaluation - OnAnyChat

 


//OnAnyChat

//first check: code

int level = 2;
try {
    level = Convert.ToInt32 (plugin.getPluginVarValue ("debug_level"));
} catch (Exception e) { }

Match m = Regex.Match (player.LastChat, @"^\s*!map\s+([^\s]+)\s+([^\s]+)$", RegexOptions.IgnoreCase);
Match m2 = Regex.Match (player.LastChat, @"^\s*!map\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)$", RegexOptions.IgnoreCase);

List<String> vips = plugin.GetReservedSlotsList ();
if (!vips.Contains (player.Name)) {
    plugin.SendPlayerMessage (player.Name, "You Can't use this command.");
    return false;
}

List<String> mapFileNames = server.MapFileNameRotation;
List<String> modeNames = server.GamemodeRotation;
List<int> rounds = server.LevelRoundsRotation;

Converter<String, int> MapCodeToIndex = delegate (String mc) {
    int i = 0;
    foreach (String mapFileName in mapFileNames) {
        if (Regex.Match (mapFileName, mc, RegexOptions.IgnoreCase).Success) {
            return i;
        }
        i = i + 1;
    }
    return i;
};

if(!m.Success) return false;

//if(!m2.Success) will fail for "m" match so leave it

if (m.Success) {
    int r = 1;
    String name = m.Groups[1].Value;
    String mode = m.Groups[2].Value;
    Dictionary<string, string> dict = new Dictionary<string, string> ();
    dict.Add ("locker", "MP_Prison");
    dict.Add ("zavod", "MP_Abandoned");
    dict.Add ("lancang", "MP_Damage");
    dict.Add ("flood", "MP_Flooded");
    dict.Add ("golmud", "MP_Journey");
    dict.Add ("paracel", "MP_Naval");
    dict.Add ("hainan", "MP_Resort");
    dict.Add ("rogue", "MP_TheDish");
    dict.Add ("dawn", "MP_Tremors");
    dict.Add ("silk", "XP1_001");
    dict.Add ("altai", "XP1_002");
    dict.Add ("gulin", "XP1_003");
    dict.Add ("dragon pass", "XP1_004");
    dict.Add ("caspian", "XP0_Caspian");
    dict.Add ("firestorm", "XP0_Firestorm");
    dict.Add ("metro", "XP0_Metro");
    dict.Add ("oman", "XP0_Oman");
    dict.Add ("islands", "XP2_001");
    dict.Add ("nansha", "XP2_002");
    dict.Add ("wavebr", "XP2_003");
    dict.Add ("mortar", "XP2_004");
    dict.Add ("pearl", "XP3_MarketPl");
    dict.Add ("propaganda", "XP3_Prpganda");
    dict.Add ("lumpini", "XP3_UrbanGdn");
    dict.Add ("sunken", "XP3_WtrFront");
    dict.Add ("whiteout", "XP4_Arctic");
    dict.Add ("hammerhead", "XP4_SubBase");
    dict.Add ("hangar", "XP4_Titan");
    dict.Add ("giants", "XP4_WalkerFactory");
    dict.Add ("night", "XP5_Night_01");
    dict.Add ("outbreak", "XP6_CMP");
    dict.Add ("valley", "XP7_Valley");
    string mapcorrect = dict[name];

    Dictionary<string, string> mapss = new Dictionary<string, string> ();
    mapss.Add ("locker", "locker");
    mapss.Add ("zavod", "zavod");
    mapss.Add ("lancang", "lancang");
    mapss.Add ("flood", "flood");
    mapss.Add ("golmud", "golmud");
    mapss.Add ("paracel", "paracel");
    mapss.Add ("hainan", "hainan");
    mapss.Add ("rogue", "rogue");
    mapss.Add ("dawn", "dawn");
    mapss.Add ("silk", "silk");
    mapss.Add ("altai", "altai");
    mapss.Add ("gulin", "gulin");
    mapss.Add ("dragon pass", "dragon pass");
    mapss.Add ("caspian", "caspian");
    mapss.Add ("firestorm", "firestorm");
    mapss.Add ("metro", "metro");
    mapss.Add ("oman", "oman");
    mapss.Add ("islands", "islands");
    mapss.Add ("nansha", "nansha");
    mapss.Add ("wavebr", "wavebr");
    mapss.Add ("mortar", "mortar");
    mapss.Add ("pearl", "pearl");
    mapss.Add ("propaganda", "propaganda");
    mapss.Add ("lumpini", "lumpini");
    mapss.Add ("sunken", "sunken");
    mapss.Add ("whiteout", "whiteout");
    mapss.Add ("hammerhead", "hammerhead");
    mapss.Add ("hangar", "hangar");
    mapss.Add ("giants", "giants");
    mapss.Add ("night", "night");
    mapss.Add ("outbreak", "outbreak");
    mapss.Add ("valley", "valley");
    string mapcheck = mapss[name];

    Dictionary<string, string> modes = new Dictionary<string, string> ();
    modes.Add ("cql", "ConquestLarge0");
    modes.Add ("cqs", "ConquestSmall0");
    modes.Add ("domination", "Domination0");
    modes.Add ("defuse", "Elimination0");
    modes.Add ("obli", "Obliteration");
    modes.Add ("rush", "RushLarge0");
    modes.Add ("tdm", "TeamDeathMatch0");
    modes.Add ("sqdm", "SquadDeathMatch0");
    modes.Add ("airsup", "AirSuperiority0");
    modes.Add ("ctf", "CaptureTheflag0");
    modes.Add ("cas", "CarrierAssaultSmall0");
    modes.Add ("cal", "CarrierAssaultLarge0");
    modes.Add ("sqobli", "SquadObliteration0");
    modes.Add ("gunmaster", "GunMaster0");
    modes.Add ("guntroll", "GunMaster1");
    string modecorrect = modes[mode];

    Dictionary<string, string> modes2 = new Dictionary<string, string> ();
    modes2.Add ("cql", "cql");
    modes2.Add ("cqs", "cqs");
    modes2.Add ("domination", "domination");
    modes2.Add ("defuse", "defuse");
    modes2.Add ("obli", "obli");
    modes2.Add ("rush", "rush");
    modes2.Add ("tdm", "tdm");
    modes2.Add ("sqdm", "sqdm");
    modes2.Add ("airsup", "airsup");
    modes2.Add ("ctf", "ctf");
    modes2.Add ("cas", "cas");
    modes2.Add ("cal", "cal");
    modes2.Add ("sqobli", "sqobli");
    modes2.Add ("gunmaster", "gunmaster");
    modes2.Add ("guntroll", "guntroll");
    string modecheck1 = modes2[mode];

    if (server.MapFileNameRotation.Contains (mapcorrect)) {

        int mapIndex = MapCodeToIndex (mapcorrect);
        if (mapIndex < modeNames.Count && modeNames[mapIndex] == modecorrect) {

            if (level >= 2) plugin.ConsoleWrite ("^b[MAP]^n special case, setting next to existing map entry #" + mapIndex + ", " + plugin.FriendlyMapName (mapcorrect));

            plugin.SendGlobalMessage ("Next map: " + plugin.FriendlyMapName (mapcorrect) + " " + plugin.FriendlyModeName (modecorrect) + " Rounds: " + r.ToString ());

            // Set it as the next map
            plugin.ServerCommand ("mapList.setNextMapIndex", mapIndex.ToString ());

            return false;
        }
    }
    int lastMap = server.MapFileNameRotation.Count;

    plugin.ConsoleWrite ("^b[MAP]^n setnext: temp map inserted at index #" + lastMap);
    plugin.SendGlobalMessage ("Next map: " + plugin.FriendlyMapName (mapcorrect) + " " + plugin.FriendlyModeName (modecorrect) + " Rounds: " + r.ToString ());
    plugin.ServerCommand ("mapList.add", mapcorrect, modecorrect, r.ToString ());
    plugin.ServerCommand ("mapList.setNextMapIndex", lastMap.ToString ());
    // Refresh map list
    plugin.ServerCommand ("mapList.list");

}

if (m2.Success) {
    int r = 1;
    String name = m2.Groups[1].Value;
    String mode = m2.Groups[2].Value;
    r = Convert.ToInt32 (m2.Groups[3].Value);

    Dictionary<string, string> dict = new Dictionary<string, string> ();
    dict.Add ("locker", "MP_Prison");
    dict.Add ("zavod", "MP_Abandoned");
    dict.Add ("lancang", "MP_Damage");
    dict.Add ("flood", "MP_Flooded");
    dict.Add ("golmud", "MP_Journey");
    dict.Add ("paracel", "MP_Naval");
    dict.Add ("hainan", "MP_Resort");
    dict.Add ("rogue", "MP_TheDish");
    dict.Add ("dawn", "MP_Tremors");
    dict.Add ("silk", "XP1_001");
    dict.Add ("altai", "XP1_002");
    dict.Add ("gulin", "XP1_003");
    dict.Add ("dragon pass", "XP1_004");
    dict.Add ("caspian", "XP0_Caspian");
    dict.Add ("firestorm", "XP0_Firestorm");
    dict.Add ("metro", "XP0_Metro");
    dict.Add ("oman", "XP0_Oman");
    dict.Add ("islands", "XP2_001");
    dict.Add ("nansha", "XP2_002");
    dict.Add ("wavebr", "XP2_003");
    dict.Add ("mortar", "XP2_004");
    dict.Add ("pearl", "XP3_MarketPl");
    dict.Add ("propaganda", "XP3_Prpganda");
    dict.Add ("lumpini", "XP3_UrbanGdn");
    dict.Add ("sunken", "XP3_WtrFront");
    dict.Add ("whiteout", "XP4_Arctic");
    dict.Add ("hammerhead", "XP4_SubBase");
    dict.Add ("hangar", "XP4_Titan");
    dict.Add ("giants", "XP4_WalkerFactory");
    dict.Add ("night", "XP5_Night_01");
    dict.Add ("outbreak", "XP6_CMP");
    dict.Add ("valley", "XP7_Valley");
    string mapcorrect = dict[name];

    Dictionary<string, string> mapss = new Dictionary<string, string> ();
    mapss.Add ("locker", "locker");
    mapss.Add ("zavod", "zavod");
    mapss.Add ("lancang", "lancang");
    mapss.Add ("flood", "flood");
    mapss.Add ("golmud", "golmud");
    mapss.Add ("paracel", "paracel");
    mapss.Add ("hainan", "hainan");
    mapss.Add ("rogue", "rogue");
    mapss.Add ("dawn", "dawn");
    mapss.Add ("silk", "silk");
    mapss.Add ("altai", "altai");
    mapss.Add ("gulin", "gulin");
    mapss.Add ("dragon pass", "dragon pass");
    mapss.Add ("caspian", "caspian");
    mapss.Add ("firestorm", "firestorm");
    mapss.Add ("metro", "metro");
    mapss.Add ("oman", "oman");
    mapss.Add ("islands", "islands");
    mapss.Add ("nansha", "nansha");
    mapss.Add ("wavebr", "wavebr");
    mapss.Add ("mortar", "mortar");
    mapss.Add ("pearl", "pearl");
    mapss.Add ("propaganda", "propaganda");
    mapss.Add ("lumpini", "lumpini");
    mapss.Add ("sunken", "sunken");
    mapss.Add ("whiteout", "whiteout");
    mapss.Add ("hammerhead", "hammerhead");
    mapss.Add ("hangar", "hangar");
    mapss.Add ("giants", "giants");
    mapss.Add ("night", "night");
    mapss.Add ("outbreak", "outbreak");
    mapss.Add ("valley", "valley");
    string mapcheck = mapss[name];

    Dictionary<string, string> modes = new Dictionary<string, string> ();
    modes.Add ("cql", "ConquestLarge0");
    modes.Add ("cqs", "ConquestSmall0");
    modes.Add ("domination", "Domination0");
    modes.Add ("defuse", "Elimination0");
    modes.Add ("obli", "Obliteration");
    modes.Add ("rush", "RushLarge0");
    modes.Add ("tdm", "TeamDeathMatch0");
    modes.Add ("sqdm", "SquadDeathMatch0");
    modes.Add ("airsup", "AirSuperiority0");
    modes.Add ("ctf", "CaptureTheflag0");
    modes.Add ("cas", "CarrierAssaultSmall0");
    modes.Add ("cal", "CarrierAssaultLarge0");
    modes.Add ("sqobli", "SquadObliteration0");
    modes.Add ("gunmaster", "GunMaster0");
    modes.Add ("guntroll", "GunMaster1");
    string modecorrect = modes[mode];

    Dictionary<string, string> modes2 = new Dictionary<string, string> ();
    modes2.Add ("cql", "cql");
    modes2.Add ("cqs", "cqs");
    modes2.Add ("domination", "domination");
    modes2.Add ("defuse", "defuse");
    modes2.Add ("obli", "obli");
    modes2.Add ("rush", "rush");
    modes2.Add ("tdm", "tdm");
    modes2.Add ("sqdm", "sqdm");
    modes2.Add ("airsup", "airsup");
    modes2.Add ("ctf", "ctf");
    modes2.Add ("cas", "cas");
    modes2.Add ("cal", "cal");
    modes2.Add ("sqobli", "sqobli");
    modes2.Add ("gunmaster", "gunmaster");
    modes2.Add ("guntroll", "guntroll");
    string modecheck1 = modes2[mode];

    if (server.MapFileNameRotation.Contains (mapcorrect)) {

        int mapIndex = MapCodeToIndex (mapcorrect);
        if (mapIndex < modeNames.Count && modeNames[mapIndex] == modecorrect) {

            if (level >= 2) plugin.ConsoleWrite ("^b[MAP]^n special case, setting next to existing map entry #" + mapIndex + ", " + plugin.FriendlyMapName (mapcorrect));

            plugin.SendGlobalMessage ("Next map: " + plugin.FriendlyMapName (mapcorrect) + " " + plugin.FriendlyModeName (modecorrect) + " Rounds: " + r.ToString ());

            // Set it as the next map
            plugin.ServerCommand ("mapList.setNextMapIndex", mapIndex.ToString ());

            return false;
        }
    }
    int lastMap = server.MapFileNameRotation.Count;

    plugin.ConsoleWrite ("^b[MAP]^n setnext: temp map inserted at index #" + lastMap);
    plugin.SendGlobalMessage ("Next map: " + plugin.FriendlyMapName (mapcorrect) + " " + plugin.FriendlyModeName (modecorrect) + " Rounds: " + r.ToString ());
    plugin.ServerCommand ("mapList.add", mapcorrect, modecorrect, r.ToString ());
    plugin.ServerCommand ("mapList.setNextMapIndex", lastMap.ToString ());
    // Refresh map list
    plugin.ServerCommand ("mapList.list");

}

 

Index check for map command: 

First check - code

evaluation - OnRoundStart

(no idea why those 2 starting methods don't work... in normal C# it work well) 
 

/*way that is broken in limits

Broken code
var index_delete = new List<int> { 2, 3, 4, 5, 6, 7, 8, 9, 10 };
foreach (int element in index_delete) {
    plugin.ServerCommand ("mapList.remove", element.ToString ());
}
    

Broken code
int indexNum = server.MapFileNameRotation.Count;
for(int i=<your default index number>;i<indexNum;i++) {
    plugin.ServerCommand ("mapList.remove", i.ToString ());
} 

Below Working code with pretty bad quality, it works for il though...
*/

int a = 11;
int b = 12;
int c = 13;
int d = 14;
int e = 15;
int f = 16;
int g = 17;
plugin.ServerCommand ("mapList.remove", a.ToString ());
plugin.ServerCommand ("mapList.remove", b.ToString ());
plugin.ServerCommand ("mapList.remove", c.ToString ());
plugin.ServerCommand ("mapList.remove", d.ToString ());
plugin.ServerCommand ("mapList.remove", e.ToString ());
plugin.ServerCommand ("mapList.remove", f.ToString ());
plugin.ServerCommand ("mapList.remove", g.ToString ());

  

Check player stats by command (regex also)

usage: !check Bartis

Evaluation - OnAnyChat

First check - code

 


Match m = Regex.Match (player.LastChat, @"^\s*[/!@]check\s+([^\s]+)", RegexOptions.IgnoreCase);
if (!m.Success)
    return false;
List<String> vips = plugin.GetReservedSlotsList ();
if (!vips.Contains (player.Name)) {
    plugin.SendPlayerMessage (player.Name, "You Can't use this command.");
    return false;
}
if (m.Success) {
    // Match target player name
    String name = m.Groups[1].Value;
    List<PlayerInfoInterface> all = new List<PlayerInfoInterface> ();
    all.AddRange (team1.players);
    all.AddRange (team2.players);
    all.AddRange (team3.players);
    all.AddRange (team4.players);
    PlayerInfoInterface target = null;
    int count = 0;
    foreach (PlayerInfoInterface p in all) {
        if (Regex.Match (p.Name, name, RegexOptions.IgnoreCase).Success) {
            target = p;
            ++count;
        }
    }
    if (count == 0 || target == null) {
        plugin.SendPlayerMessage (player.Name, "No player name matches '" + name + "'");
        return false;
    } else if (count > 1) {
        plugin.SendPlayerMessage (player.Name, "Too many names match '" + name + "', try again");
        return false;
    }

    double headshots = target.HeadshotsRound;
    double killsNOW = target.KillsRound;
    double result = Math.Round ((headshots / killsNOW), 2);

    plugin.SendPlayerMessage (player.Name, target.Name + " stats:");
    plugin.SendPlayerMessage (player.Name, target.Name + " K/D: " + "[" + target.Kdr + "]" + " | " + "REAL K/D: " + "[" + (target.Kills / target.Deaths).ToString ("F2") + "]");
    plugin.SendPlayerMessage (player.Name, target.Name + " Wins: " + (((target.Wins) / (target.Wins + target.Losses)) * 100).ToString ("F2") + "%" + " |" + " Skill: " + target.Skill + " | " + "KPM: " + target.Kpm.ToString ("F2"));
    plugin.SendPlayerMessage (player.Name, target.Name + " HS on Round: " + result*100 + "%.");
    plugin.SendPlayerMessage (player.Name, target.Name + " KPM on Round: " + Math.Round ((target.KpmRound),2));
    plugin.SendPlayerMessage (player.Name, target.Name + " Country: " + target.CountryName + ".");
}



Send reports through discord webhook using WebClient C# 
Paste your channel discord webhook string to get it working on discord!

Also script working with regex
Usage: !report Bartis killing team

Evaluation -  OnAnyChat

first check  - Expression

(Regex.Match(player.LastChat, @"[/!@]report" ,RegexOptions.IgnoreCase).Success)


Second Check - Code



string webhookUrl = "";
String serverName = server.Name;
string webhookString = null;

// Don't edit
String playerName = null;
String playerMessage = null;
String reportReason = null;
Match regexResult = null;

Match regexMatch = Regex.Match (player.LastChat, @"^\s*[/!@]report\s+([^\s]+)\s+([^.*]+)", RegexOptions.IgnoreCase);


if (regexMatch.Success) {
	regexResult = regexMatch;
} else {
	playerMessage = "Error! Correct command: !report <part of playername> <reason>";
	plugin.SendPlayerMessage (player.Name, playerMessage);
	return false;
}
double counter = limit.Activations(player.Name, TimeSpan.FromSeconds(60));

if(counter >1) {
    playerMessage = "Too many reports! Try again in 1min";
    return false;
}
String name = regexResult.Groups[1].Value;
List<PlayerInfoInterface> all = new List<PlayerInfoInterface> ();
all.AddRange (team1.players);
all.AddRange (team2.players);
if (team3.players.Count > 0) all.AddRange (team3.players);
if (team4.players.Count > 0) all.AddRange (team4.players);
PlayerInfoInterface target = null;
int count = 0;
foreach (PlayerInfoInterface p in all) {
	if (Regex.Match (p.Name, name, RegexOptions.IgnoreCase).Success) {
		target = p;
		++count;
		playerName = p.Name;
	}
}

String BL = "https://battlelog.battlefield.com/bf4/user/" + playerName;
if (count == 0) {
	playerMessage = "No such player name matches (" + name + ")";
	plugin.SendPlayerMessage (player.Name, playerMessage);
	return false;
} else if (count > 1) {
	playerMessage = "Multiple players match the target name (" + name + "), try again!";
	plugin.SendPlayerMessage (player.Name, playerMessage);
	return false;
} else if (count == 1) {
	reportReason = regexResult.Groups[2].Value;
	double headshots = target.HeadshotsRound;
	double killsNOW = target.KillsRound;
	double result = Math.Round ((headshots / killsNOW), 2);
	double KPM = Math.Round ((target.KpmRound), 2);
	double HS = result * 100;
	double KD = Math.Round (target.KdrRound, 2);
	double Kills = target.KillsRound;
	double Deaths = target.DeathsRound;
	try {
		WebRequest request = WebRequest.Create (webhookUrl);
		request.Method = "POST";
		request.ContentType = "application/json";
		webhookString = "{\"content\": \"**```py\\n'Player Report'\\n@" + serverName + "\\nReported_from: " + "'" + player.Name + "'" + "\\nReported_player: " + "'" + playerName + "'" + "\\nReason: " + "'" + reportReason + "'" + "\\nStats: " + "KILLS: " + Kills + " DEATHS: " + Deaths + " HS: " + HS + "%" + " KD: " + KD + " KPM: " + KPM + "\\n```**"+"BL: "+BL + "\"}";
		byte[] byteArray = Encoding.UTF8.GetBytes (webhookString);
		request.ContentLength = byteArray.Length;
		Stream dataStream = request.GetRequestStream ();
		dataStream.Write (byteArray, 0, byteArray.Length);
		dataStream.Close ();
		plugin.ConsoleWrite ("Received a report from " + player.Name);
		playerMessage = "Thanks, we have received your report!";
		plugin.SendPlayerMessage (player.Name, playerMessage);
		plugin.SendPlayerYell (player.Name, playerMessage, 10);
	} catch (Exception e) {
		plugin.ConsoleWrite ("Error: " + e);
		playerMessage = "Plugin error! Please try again later.";
		plugin.SendPlayerMessage (player.Name, playerMessage);
		plugin.SendPlayerYell (player.Name, playerMessage, 10);
	}
}

return false;


Last script: Custom factions per map

Evaluation -  OnAnyChat

first check  - Code
 

String msg = "";
int Team1 = 0;
int Team2 = 0;
int i = 0;

Dictionary<int,String> Teams = new Dictionary<int,String>();
Teams.Add(0, "US");
Teams.Add(1, "RU");
Teams.Add(2, "CN");

if (server.NextGamemode == "ConquestLarge0" && server.NextGamemode != "RushLarge0") {// CQL
switch (server.NextMapFileName)
{
	case "MP_Tremors":
		Team1 = 0;
		Team2 = 2;
		break;
	case "MP_Siege":
		Team1 = 0;
		Team2 = 2;
		break;
	case "MP_Damage":
		Team1 = 1;
		Team2 = 2;
		break;
	case "MP_Journey":
		Team1 = 1;
		Team2 = 2;
		break;
	case "MP_TheDish":	
		Team1 = 1;
		Team2 = 2;
		break;
	case "MP_Prison":
		Team1 = 0;
		Team2 = 1;
		break;
	case "MP_Flooded":
		Team1 = 0;
		Team2 = 0;
		break;
	case "MP_Abandoned":
		Team1 = 0;
		Team2 = 2;
		break;
	case "MP_Naval":
		Team1 = 0;
		Team2 = 2;
		break;
	case "MP_Resort":
		Team1 = 0;
		Team2 = 2;
		break;
}
}
if (server.NextGamemode == "RushLarge0") { //RUSH
switch (server.NextMapFileName)
{
	case "MP_Tremors":
		Team1 = 0;
		Team2 = 2;
		break;
	case "MP_Siege":
		Team1 = 1;
		Team2 = 2;
		break;
	case "MP_Damage":
		Team1 = 1;
		Team2 = 2;
		break;
	case "MP_Journey":
		Team1 = 1;
		Team2 = 2;
		break;
	case "MP_TheDish":	
		Team1 = 1;
		Team2 = 2;
		break;
	case "MP_Prison":
		Team1 = 0;
		Team2 = 1;
		break;
	case "MP_Flooded":
		Team1 = 0;
		Team2 = 2;
		break;
	case "MP_Abandoned":
		Team1 = 1;
		Team2 = 2;
		break;
	case "MP_Naval":
		Team1 = 0;
		Team2 = 2;
		break;
	case "MP_Resort":
		Team1 = 0;
		Team2 = 2;
		break;
}
}
 //Special DLC Cases

if(server.NextMapFileName.StartsWith("XP1_")) {
	Team1 = 0;
	Team2 = 2;
}
if(server.NextMapFileName.StartsWith("XP2_")) {
	Team1 = 0;
	Team2 = 1;
}
if(server.NextMapFileName.StartsWith("XP3_")) {
	Team1 = 0;
	Team2 = 2;
}
if(server.NextMapFileName.StartsWith("XP4_")) {
	Team1 = 0;
	Team2 = 1;
}
if(server.NextMapFileName.StartsWith("XP5_Night_01")) {
	Team1 = 1;
	Team2 = 0;
}
if(server.NextMapFileName.StartsWith("XP6_CMP")) {
	Team1 = 0;
	Team2 = 2;
}
if(server.NextMapFileName.StartsWith("XP7_Valley")) {
	Team1 = 0;
	Team2 = 2;
 }


plugin.ServerCommand("vars.teamFactionOverride", "1", Convert.ToString(Team1));
plugin.ServerCommand("vars.teamFactionOverride", "2", Convert.ToString(Team2));
msg = "Setting factions to " + Teams[Team1] + " vs " + Teams[Team2] + " on next round...";

plugin.SendGlobalMessage(msg, 12);
plugin.ConsoleWrite("^b^1ADMIN FACTIONS >^0^n " + msg);
plugin.PRoConChat("^b^1ADMIN FACTIONS >^0^n " + msg);
plugin.PRoConEvent(msg, "Insane Limits");

return false;

Consider switching to C# switch cases, I made "if" because the dlcs map factions are the same on each DLC and I was also too lazy
 

Use any script you would like to...

For bugs add me on discord (Bartis#1313) or write them here 

Link to comment

Archived

This topic is now archived and is closed to further replies.



  • Our picks

    • Game Server Hosting:

      We're happy to announce that EZRCON will branch out into the game server provider scene. This is a big step for us so please having patience if something doesn't go right in this area. Now, what makes us different compared to other providers? Well, we're going with the idea of having a scaleable server hosting and providing more control in how you set up your server. For example, in Minecraft, you have the ability to control how many CPU cores you wish your server to have access to, how much RAM you want to use, how much disk space you want to use. This type of control can't be offered in a single service package so you're able to configure a custom package the way you want it.

      You can see all the available games here. Currently, we have the following games available.

      Valheim (From $1.50 USD)


      Rust (From $3.20 USD)


      Minecraft (Basic) (From $4.00 USD)


      Call of Duty 4X (From $7.00 USD)


      OpenTTD (From $4.00 USD)


      Squad (From $9.00 USD)


      Insurgency: Sandstorm (From $6.40 USD)


      Changes to US-East:

      Starting in January 2022, we will be moving to a different provider that has better support, better infrastructure, and better connectivity. We've noticed that the connection/routes to this location are not ideal and it's been hard getting support to correct this. Our contract for our two servers ends in March/April respectively. If you currently have servers in this location you will be migrated over to the new provider. We'll have more details when the time comes closer to January. The new location for this change will be based out of Atlanta, GA. If you have any questions/concerns please open a ticket and we'll do our best to answer them.
      • 5 replies
    • Hello All,

      I wanted to give an update to how EZRCON is doing. As of today we have 56 active customers using the services offered. I'm glad its doing so well and it hasn't been 1 year yet. To those that have services with EZRCON, I hope the service is doing well and if not please let us know so that we can improve it where possible. We've done quite a few changes behind the scenes to improve the performance hopefully. 

      We'll be launching a new location for hosting procon layers in either Los Angeles, USA or Chicago, IL. Still being decided on where the placement should be but these two locations are not set in stone yet. We would like to get feedback on where we should have a new location for hosting the Procon Layers, which you can do by replying to this topic. A poll will be created where people can vote on which location they would like to see.

      We're also looking for some suggestions on what else you would like to see for hosting provider options. So please let us know your thoughts on this matter.
      • 4 replies
    • Added ability to disable the new API check for player country info


      Updated GeoIP database file


      Removed usage sending stats


      Added EZRCON ad banner



      If you are upgrading then you may need to add these two lines to your existing installation in the file procon.cfg. To enable these options just change False to True.

      procon.private.options.UseGeoIpFileOnly False
      procon.private.options.BlockRssFeedNews False



       
      • 2 replies
    • I wanted I let you know that I am starting to build out the foundation for the hosting services that I talked about here. The pricing model I was originally going for wasn't going to be suitable for how I want to build it. So instead I decided to offer each service as it's own product instead of a package deal. In the future, hopefully, I will be able to do this and offer discounts to those that choose it.

      Here is how the pricing is laid out for each service as well as information about each. This is as of 7/12/2020.

      Single MySQL database (up to 30 GB) is $10 USD per month.



      If you go over the 30 GB usage for the database then each additional gigabyte is charged at $0.10 USD each billing cycle. If you're under 30GB you don't need to worry about this.


      Databases are replicated across 3 zones (regions) for redundancy. One (1) on the east coast of the USA, One (1) in Frankfurt, and One (1) in Singapore. Depending on the demand, this would grow to more regions.


      Databases will also be backed up daily and retained for 7 days.




      Procon Layer will be $2 USD per month.


      Each layer will only allow one (1) game server connection. The reason behind this is for performance.


      Each layer will also come with all available plugins installed by default. This is to help facilitate faster deployments and get you up and running quickly.


      Each layer will automatically restart if Procon crashes. 


      Each layer will also automatically restart daily at midnight to make sure it stays in tip-top shape.


      Custom plugins can be installed by submitting a support ticket.




      Battlefield Admin Control Panel (BFACP) will be $5 USD per month


      As I am still working on building version 3 of the software, I will be installing the last version I did. Once I complete version 3 it will automatically be upgraded for you.





      All these services will be managed by me so you don't have to worry about the technical side of things to get up and going.

      If you would like to see how much it would cost for the services, I made a calculator that you can use. It can be found here https://ezrcon.com/calculator.html

       
      • 11 replies
    • I have pushed out a new minor release which updates the geodata pull (flags in the playerlisting). This should be way more accurate now. As always, please let me know if any problems show up.

       
      • 9 replies
×
×
  • Create New...

Important Information

Please review our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.