Jump to content

Insane Limits - Examples


Recommended Posts

Originally Posted by Kinsman*:

 

Use OnIntervalServer, don't use OnInterval or OnIntervalPlayer.

Thanks, but now i get this error_?

 

ERROR: 2 errors compiling Expression

[17:19:00 87] [insane Limits] Thread(settings): ERROR: (CS0103, line: 22, column: 25): The name 'player' does not exist in the current context

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

Trying to wade through this thread but I cannot find a "last kill" message expression here, only first kills. Any help is much obliged.

Post your request here:

 

Insane Limits Requests*

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

Thanks, but now i get this error_?

 

ERROR: 2 errors compiling Expression

[17:19:00 87] [insane Limits] Thread(settings): ERROR: (CS0103, line: 22, column: 25): The name 'player' does not exist in the current context

Let's continue this discussion in the Requests thread:

 

myrcon.net/...insane-limits-requests#entry25485

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by CPx4*:

 

(UPDATED this code with PapaCharlie9's suggestions a few posts below this one. This has the latest code. Thanks!)

 

 

Title: Spawn (yell) messages based on Date/Time

Description: Looking to yell a message to a player, but only during a certain Date/Time? Maybe for EA's Double XP weekend? OR with a little modification, a countdown to a planned reboot, planned MapPack install (like Armored Fury, etc)?

 

For example: Between June 16th 3:01 AM (EST) and June 18th 2:59 AM (EST), yells on 2nd spawn:

"Enjoy EAs Double XP weekend! You have 13 hour(s) and 4 min(s) left to keep earning Double XP!

 

evaluation: OnSpawn

first_check: Expression

first_check_expression: true

second_check: code

second_check_code:

 

Code:

if (limit.ActivationsTotal(player.Name) == 2){ // On the 2nd spawn of the player
     DateTime dateStartDateTime = new DateTime(2012,6,16,3,1,0); // Start date of message (Year, Month, Day, Hour, Min, Second)
     DateTime dateEndDateTime = new DateTime(2012,6,18,2,59,0); //End date of message (Year, Month, Day, Hour, Min, Second) 
     if ((DateTime.Now > dateStartDateTime) && (DateTime.Now < dateEndDateTime)){ // Checks if NOW falls between your two dates
         TimeSpan tsHoursMinsLeft= dateEndDateTime - DateTime.Now; // Find the difference in time
         int differenceInHours = (int)  tsHoursMinsLeft.TotalHours; // Gets the difference in hours
         int differenceInMinutes = (int) Math.Ceiling((double)tsHoursMinsLeft.Minutes); // Gets the mins left
         String msgSpawn2 = "Enjoy EAs Double XP weekend!   You have " + differenceInHours + " hour(s) and " + differenceInMinutes + " min(s) left to keep earning Double XP!"; //The message you output
         plugin.ServerCommand("admin.yell", msgSpawn2, "10", "player", player.Name); // Yells to the player that spawned
     }  
}
Notes: The dates/times above are based off EST.

 

I'm open to improvements! New at C# coding. Hope it's useful.

 

- CPx4

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by CPx4*:

 

This is a modification of Fruity and Singh400's "@shownext" code, and includes new "Close Quarters" maps as of R-26

 

Changes from Fruity's code* and Singh400's code*:

1) Added the Close Quarters modes/maps

2) Accepts '@shownext', '@nextmap', '@nextround', and is case in-sensitive

3) Yells to the player who requested it

4) Tells you which Map/Mode is next if it's the last of that map. Otherwise, tells you how many rounds of that map.

5) Changed references from "Conquest 64" to "Conquest Large" to match Battlelog. Changed references from "DeathMatch" to "DM" per Battlelog.

 

Examples...

If you're currently on round 1 on Karkand... @shownext would yell:

"Up Next: Round 2/2 on Strike at Karkand (Rush) (then Gulf of Oman)"

 

If you're currently on round 2 on Karkand... @shownext would yell:

"Up Next: Gulf of Oman (Rush)"

 

(Currently InsaneLimits doesn't have the ability to pull/manipulate the maplist, so we can't tell how many rounds of a future map are, nor can we show players what maps are after the 'next' map. Will be happy to update this code if PapaCharlie9 allows improved MapList manipulation.)

 

Here's what you need to input into InsaneLimits...

 

evaluation: OnAnyChat

first_check: Expression

first_check_expression: player.LastChat.StartsWith("@")

second_check: Code

second_check_code:

Code:

if ( Regex.Match(player.LastChat, @"\s*[@](_:shownext|nextmap|nextround)", RegexOptions.IgnoreCase).Success ){
/* BF3 friendly map names, including B2K and CQ */
    Dictionary<String, String> Maps = new Dictionary<String, String>();
    Maps.Add("MP_001", "Grand Bazaar");
    Maps.Add("MP_003", "Teheran Highway");
    Maps.Add("MP_007", "Caspian Border");
    Maps.Add("MP_011", "Seine Crossing");
    Maps.Add("MP_012", "Operation Firestorm");
    Maps.Add("MP_013", "Damavand Peak");
    Maps.Add("MP_017", "Noshahr Canals");
    Maps.Add("MP_018", "Kharg Island");
    Maps.Add("MP_Subway", "Operation Metro");
    Maps.Add("XP1_001", "Strike At Karkand");
    Maps.Add("XP1_002", "Gulf of Oman");
    Maps.Add("XP1_003", "Sharqi Peninsula");
    Maps.Add("XP1_004", "Wake Island");
    Maps.Add("XP2_Palace","Donya Fortress");
    Maps.Add("XP2_Office","Operation 925");
    Maps.Add("XP2_Factory","Scrapmetal");
    Maps.Add("XP2_Skybar","Ziba Tower");
    
    /* BF3 friendly game modes, including B2K and CQ */
    Dictionary<String, String> Modes = new Dictionary<String, String>();    
    Modes.Add("ConquestLarge0", "Conquest Large");
    Modes.Add("ConquestAssaultLarge0", "Conquest Assault Large");
    Modes.Add("ConquestSmall0", "Conquest Small");
    Modes.Add("ConquestAssaultSmall0", "Conquest Assault Small");
    Modes.Add("ConquestAssaultSmall1", "Conquest Assault Small");
    Modes.Add("RushLarge0", "Rush");
    Modes.Add("SquadRush0", "Squad Rush");
    Modes.Add("SquadDeathMatch0", "Squad DM");						
    Modes.Add("TeamDeathMatch0", "Team DM");
    Modes.Add("Domination0","Domination");
    Modes.Add("GunMaster0", "Gun Master");
    Modes.Add("TeamDeathMatchC0","Team DM Close Quarters");

	if (server.CurrentRound+1 == server.TotalRounds){
		if (Maps.ContainsKey(server.NextMapFileName) && Modes.ContainsKey(server.NextGamemode))
			plugin.ServerCommand("admin.yell", "Up Next: " + Maps[server.NextMapFileName] + " (" + Modes[server.NextGamemode] + ")");
	}
	else if (server.CurrentRound+1 < server.TotalRounds){
		if (Maps.ContainsKey(server.MapFileName) && Modes.ContainsKey(server.Gamemode) && Maps.ContainsKey(server.NextMapFileName) && Modes.ContainsKey(server.NextGamemode))
			plugin.ServerCommand("admin.yell", "Up Next: Round " + (server.CurrentRound+2) + "/" + server.TotalRounds + " on " + Maps[server.MapFileName] + " (" + Modes[server.Gamemode] + ")   (then " + Maps[server.NextMapFileName] + ")");
	}
}
Thanks Fruity and Singh400 for the original code!

 

Just learning C#, so pardon my poor programming. I'm open to improvements/suggestions.

 

- CPx4

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

Title: Spawn (yell) messages based on Date/Time

Description: Looking to yell a message to a player, but only during a certain Date/Time? Maybe for EA's Double XP weekend? OR with a little modification, a countdown to a planned reboot, planned MapPack install (like Armored Fury, etc)?

 

For example: Between June 16th 3:01 AM (EST) and June 18th 2:59 AM (EST), yells on 2nd spawn:

"Enjoy EAs Double XP weekend! You have 13 hour(s) and 4 min(s) left to keep earning Double XP!

 

evaluation: OnSpawn

first_check: Expression

first_check_expression: true

second_check: code

second_check_code:

 

Code:

if (limit.ActivationsTotal(player.Name) == 2){ // On the 2nd spawn of the player
     DateTime dateStartDateTime = new DateTime(2012,6,16,3,1,0); // Start date of message (Year, Month, Day, Hour, Min, Second)
     DateTime dateEndDateTime = new DateTime(2012,6,18,2,59,0); //End date of message (Year, Month, Day, Hour, Min, Second) 
     if ((DateTime.Now > dateStartDateTime) && (DateTime.Now < dateEndDateTime)){ // Checks if NOW falls between your two dates
         TimeSpan tsHoursMinsLeft= dateEndDateTime - DateTime.Now; // Find the difference in time
         double differenceInHours = (int) tsHoursMinsLeft.TotalHours; // Gets the difference in hours
         int differenceInMinutes = tsHoursMinsLeft.Minutes; // Gets the mins left
         String msgSpawn2 = "Enjoy EAs Double XP weekend!   You have " + differenceInHours + " hour(s) and " + differenceInMinutes + " min(s) left to keep earning Double XP!"; //The message you output
         plugin.ServerCommand("admin.yell", msgSpawn2, "10", "player", player.Name); // Yells to the player that spawned
     }  
}
Notes: The dates/times above are based off EST.

 

I'm open to improvements! New at C# coding. Hope it's useful.

 

- CPx4

Nice idea!

 

I think there are a couple of minor problems with the code though:

 

Code:

double differenceInHours = (int) tsHoursMinsLeft.TotalHours; // Gets the difference in hours
         int differenceInMinutes = tsHoursMinsLeft.Minutes; // Gets the mins left
I think this would be better:

 

 

Code:

int differenceInHours = (int)  tsHoursMinsLeft.TotalHours; // Gets the difference in hours
         int differenceInMinutes = (int) Math.Ceiling(tsHoursMinsLeft.Minutes); // Gets the mins left
You need the ceiling in order to get the fractional conversions to look sensible in the message, otherwise, you might get 0 hours and 0 minutes when there are 59 seconds left.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Singh400*:

 

Title: Spawn (yell) messages based on Date/Time

Description: Looking to yell a message to a player, but only during a certain Date/Time? Maybe for EA's Double XP weekend? OR with a little modification, a countdown to a planned reboot, planned MapPack install (like Armored Fury, etc)?

 

For example: Between June 16th 3:01 AM (EST) and June 18th 2:59 AM (EST), yells on 2nd spawn:

"Enjoy EAs Double XP weekend! You have 13 hour(s) and 4 min(s) left to keep earning Double XP!

 

evaluation: OnSpawn

first_check: Expression

first_check_expression: true

second_check: code

second_check_code:

 

Code:

if (limit.ActivationsTotal(player.Name) == 2){ // On the 2nd spawn of the player
     DateTime dateStartDateTime = new DateTime(2012,6,16,3,1,0); // Start date of message (Year, Month, Day, Hour, Min, Second)
     DateTime dateEndDateTime = new DateTime(2012,6,18,2,59,0); //End date of message (Year, Month, Day, Hour, Min, Second) 
     if ((DateTime.Now > dateStartDateTime) && (DateTime.Now < dateEndDateTime)){ // Checks if NOW falls between your two dates
         TimeSpan tsHoursMinsLeft= dateEndDateTime - DateTime.Now; // Find the difference in time
         double differenceInHours = (int) tsHoursMinsLeft.TotalHours; // Gets the difference in hours
         int differenceInMinutes = tsHoursMinsLeft.Minutes; // Gets the mins left
         String msgSpawn2 = "Enjoy EAs Double XP weekend!   You have " + differenceInHours + " hour(s) and " + differenceInMinutes + " min(s) left to keep earning Double XP!"; //The message you output
         plugin.ServerCommand("admin.yell", msgSpawn2, "10", "player", player.Name); // Yells to the player that spawned
     }  
}
Notes: The dates/times above are based off EST.

 

I'm open to improvements! New at C# coding. Hope it's useful.

 

- CPx4

Fantastic idea! My only concern would be running it on my layer as that uses a completely different date/time format. Would that be an issue?
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by CPx4*:

 

PapaCharlie, thanks for the updates! The 2nd update (Math.Ceiling) gave an error:

"The call is ambiguous between the following methods or properties: 'System.Math.Ceiling(decimal)' and 'System.Math.Ceiling(double)'"

 

Singh, no clue. But, you can certainly output a "DateTime.Now" to see what your current date/time is. Then, simply adjust the "dateStartDateTime" and "dateEndDateTime" variables to mach. (In my example, I used EST dates/times. You might use a different one.)

 

For example: EA published 12:01 PST. I did a "DateTime.Now" and saw Procon thought it was EST (+3 hours), so I simply changed my dateStartDateTime to 3:01.

 

- CPx4

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

PapaCharlie, thanks for the updates! The 2nd update (Math.Ceiling) gave an error:

"The call is ambiguous between the following methods or properties: 'System.Math.Ceiling(decimal)' and 'System.Math.Ceiling(double)'"

That's weird. I have almost identical code (uses TotalMinutes instead of Minutes) and it compiles fine for me. Maybe try a cast of the parameter?

 

Code:

int differenceInMinutes = (int) Math.Ceiling((double)tsHoursMinsLeft.Minutes); // Gets the mins left
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Realtec*:

 

I have a problem with the weapon names.

Sometimes i get weird names like Weapons/Gadgets/Claymore/Claymore

For displaying messages to players this is kinda ugly.

 

I already find something usefull on this forum:

 

Code:

Match m = Regex.Match(kill.Weapon, @"/[^/]+$");
String wn = kill.Weapon;
if(m.Success) wn = m.Groups[1].Value;
I've used this solution for a while and it works and i get normal weapon names.

But sometimes there is no weapon name.

 

Can someone help me to improve this code so the weapon names are clean?

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

I have a problem with the weapon names.

Sometimes i get weird names like Weapons/Gadgets/Claymore/Claymore

For displaying messages to players this is kinda ugly.

 

I already find something usefull on this forum:

 

Code:

Match m = Regex.Match(kill.Weapon, @"/[^/]+$");
String wn = kill.Weapon;
if(m.Success) wn = m.Groups[1].Value;
I've used this solution for a while and it works and i get normal weapon names.

But sometimes there is no weapon name.

 

Can someone help me to improve this code so the weapon names are clean?

Please post your request in the Requests thread:

 

www.phogue.net/forumvb/showth...imits-Requests*

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Singh400*:

 

Used by players to kill themselves when they get bugged out at the spawn deployment menu.

 

Set the evaluation to OnAnyChat.

 

Set first_check to this code:

Code:

if ( Regex.Match ( player.LastChat, @"(_:stuck)", RegexOptions.IgnoreCase ).Success ) 
	{
		string msg1 = "Type @killme if you are stuck at the deploy screen" ;
		plugin.ServerCommand ( "admin.say" , msg1, "player" , player.Name ) ;
		plugin.ServerCommand ( "admin.yell" , msg1 , "8" , "player" , player.Name ) ;
	}
	
return true;
Set second_check to this code:

Code:

if ( Regex.Match ( player.LastChat, @"^\s*[@](_:slayme)", RegexOptions.IgnoreCase).Success )
	{
		string msg2 = "Killing " + player.Name + " in 3 seconds!" ;
		plugin.ServerCommand ( "admin.say" , msg2 , "player" , player.Name ) ;
		plugin.ServerCommand ( "admin.yell" , msg2 , "8", "player" , player.Name ) ;
		plugin.KillPlayer ( player.Name , 3 );
	}

return false;
The code to limit to three self-kills has been removed due to the fact it was working incorrectly.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Singh400*:

 

Singh, no clue. But, you can certainly output a "DateTime.Now" to see what your current date/time is. Then, simply adjust the "dateStartDateTime" and "dateEndDateTime" variables to mach. (In my example, I used EST dates/times. You might use a different one.)

 

For example: EA published 12:01 PST. I did a "DateTime.Now" and saw Procon thought it was EST (+3 hours), so I simply changed my dateStartDateTime to 3:01.

 

- CPx4

Got round to do that now...

 

Code:

// On the 2nd spawn of the player
if ( limit.ActivationsTotal ( player.Name ) == 2 )
	{
	// Start date of message (MM, DD, YY, HH, MIN, SECS)
	DateTime dateStartDateTime = new DateTime(6,23,2012,8,1,0);
	
	// Start date of message (MM, DD, YY, HH, MIN, SECS)
	DateTime dateEndDateTime = new DateTime(6,25,2012,7,59,0);
	
		// Checks if NOW falls between your two dates
		if ( ( DateTime.Now > dateStartDateTime ) && ( DateTime.Now < dateEndDateTime ) )
			{
				// Find the difference in time
				TimeSpan tsHoursMinsLeft = dateEndDateTime - DateTime.Now;
				
				// Gets the difference in hours
				int differenceInHours = (int) tsHoursMinsLeft.TotalHours;
				
				// Gets the mins left
				int differenceInMinutes = (int) Math.Ceiling((double)tsHoursMinsLeft.Minutes);
				
				//The message you output
				String msgSpawn2 = "Enjoy BF3s double XP weekend! You have " + differenceInHours + " hour(s) and " + differenceInMinutes + " min(s) left to keep earning double XP!";
				
				// Yells to the player that spawned
				plugin.ServerCommand("admin.yell", msgSpawn2, "10", "player", player.Name);
			}  
	}
Such a pain in the ass when the layers has a US date/time format!
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

Used by players to kill themselves when they get bugged out at the spawn deployment menu.

 

Set first_check to this code:

Code:

if ( Regex.Match ( player.LastChat, @"(_:stuck)", RegexOptions.IgnoreCase ).Success ) 
	{
		string msg1 = "Type @killme if you are stuck at the deploy screen" ;
		plugin.ServerCommand ( "admin.say" , msg1, "player" , player.Name ) ;
		plugin.ServerCommand ( "admin.yell" , msg1 , "8" , "player" , player.Name ) ;
	}
	
return true;
Set second_check to this code:

Code:

if ( limit.Activations ( player.Name ) > 3 )
	return false;

if ( Regex.Match ( player.LastChat, @"^\s*[@](_:killme)", RegexOptions.IgnoreCase).Success )
	{
		string msg2 = "Killing " + player.Name + " in 3 seconds!" ;
		plugin.ServerCommand ( "admin.say" , msg2 , "player" , player.Name ) ;
		plugin.ServerCommand ( "admin.yell" , msg2 , "8", "player" , player.Name ) ;
		plugin.KillPlayer ( player.Name , 3 );
	}

return false;
It allows the player to kill themselves no more than 3 times per round.
Clever. I'm going to steal your technique of putting the chat trigger hinting in first_check and the actual command processing in second_check.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

Such a pain in the ass when the layers has a US date/time format!

Hint: Google "msdn C# XXX", where XXX is whatever class or function you are using, like DateTime. I rarely fail to find what I want there. You can get UTC as well as local time for DateTime, plus there is a converter function TimeZoneInfo.ConvertTime to convert from one tz to another.

 

Just make sure you set the documentation version for .Net to 3.5 at the top of the MSDN page.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Singh400*:

 

Clever. I'm going to steal your technique of putting the chat trigger hinting in first_check and the actual command processing in second_check.

I have my moments. I'm getting good at following the logic. But I had REAL trouble with the Regex.Match function. At one point it would kill me instantly if I typed anything :huh:

 

Got it in the end though. Baby steps :biggrin:

 

Hint: Google "msdn C# XXX", where XXX is whatever class or function you are using, like DateTime. I rarely fail to find what I want there. You can get UTC as well as local time for DateTime, plus there is a converter function TimeZoneInfo.ConvertTime to convert from one tz to another.

 

Just make sure you set the documentation version for .Net to 3.5 at the top of the MSDN page.

Yeah, I've come across that a few times. Thanks though. I ended up just cheating, and doing plugin.ConsoleWrite(DateTime.Now) looking at the format (in this case MM/DD/YY HH:MM:SS) and changing the values appropriately.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Singh400*:

 

Got round to do that now...

 

Code:

// On the 2nd spawn of the player
if ( limit.ActivationsTotal ( player.Name ) == 2 )
	{
	// Start date of message (MM, DD, YY, HH, MIN, SECS)
	DateTime dateStartDateTime = new DateTime(6,23,2012,8,1,0);
	
	// Start date of message (MM, DD, YY, HH, MIN, SECS)
	DateTime dateEndDateTime = new DateTime(6,25,2012,7,59,0);
	
		// Checks if NOW falls between your two dates
		if ( ( DateTime.Now > dateStartDateTime ) && ( DateTime.Now < dateEndDateTime ) )
			{
				// Find the difference in time
				TimeSpan tsHoursMinsLeft = dateEndDateTime - DateTime.Now;
				
				// Gets the difference in hours
				int differenceInHours = (int) tsHoursMinsLeft.TotalHours;
				
				// Gets the mins left
				int differenceInMinutes = (int) Math.Ceiling((double)tsHoursMinsLeft.Minutes);
				
				//The message you output
				String msgSpawn2 = "Enjoy BF3s double XP weekend! You have " + differenceInHours + " hour(s) and " + differenceInMinutes + " min(s) left to keep earning double XP!";
				
				// Yells to the player that spawned
				plugin.ServerCommand("admin.yell", msgSpawn2, "10", "player", player.Name);
			}  
	}
Such a pain in the ass when the layers has a US date/time format!
Ran the code today and it errored out:-

Code:

[13:18:12 92] [Insane Limits] EXCEPTION: LimitEvaluator4: System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.
[13:18:13 26] [Insane Limits] Extra information dumped in file InsaneLimits.dump
[13:18:14 70] [Insane Limits] EXCEPTION: LimitEvaluator4: System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.
[13:18:14 70] [Insane Limits] Extra information dumped in file InsaneLimits.dump
[13:18:18 51] [Insane Limits] EXCEPTION: LimitEvaluator4: System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.
[13:18:18 51] [Insane Limits] Extra information dumped in file InsaneLimits.dump
[13:18:18 78] [Insane Limits] EXCEPTION: LimitEvaluator4: System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.
[13:18:18 84] [Insane Limits] Extra information dumped in file InsaneLimits.dump
[13:18:20 00] [Insane Limits] EXCEPTION: LimitEvaluator4: System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.
[13:18:20 00] [Insane Limits] Extra information dumped in file InsaneLimits.dump
[13:18:27 36] [Insane Limits] EXCEPTION: LimitEvaluator4: System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.
[13:18:27 36] [Insane Limits] Extra information dumped in file InsaneLimits.dump
[13:18:28 00] [Insane Limits] EXCEPTION: LimitEvaluator4: System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.
[13:18:28 00] [Insane Limits] Extra information dumped in file InsaneLimits.dump
[13:18:28 53] [Insane Limits] EXCEPTION: LimitEvaluator4: System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.
[13:18:28 53] [Insane Limits] Extra information dumped in file InsaneLimits.dump
[13:18:29 59] [Insane Limits] EXCEPTION: LimitEvaluator4: System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.
[13:18:29 59] [Insane Limits] Extra information dumped in file InsaneLimits.dump
[13:18:29 78] [Insane Limits] EXCEPTION: LimitEvaluator4: System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.
[13:18:29 78] [Insane Limits] Extra information dumped in file InsaneLimits.dump
Turns out it prefers YY-MM-DD HH:MM:SS even when the layer date format is US-style.

 

So I've edited my code accordingly:-

Code:

// On the 2nd spawn of the player
if ( limit.ActivationsTotal ( player.Name ) == 2 )
	{
	// Start date of message (YY, MM, DD, HH, MIN, SECS)
	DateTime dateStartDateTime = new DateTime(2012,6,23,8,1,0);
	
	// Start date of message (YY, MM, DD, HH, MIN, SECS)
	DateTime dateEndDateTime = new DateTime(2012,6,25,7,59,0);
	
		// Checks if NOW falls between your two dates
		if ( ( DateTime.Now > dateStartDateTime ) && ( DateTime.Now < dateEndDateTime ) )
			{
				// Find the difference in time
				TimeSpan tsHoursMinsLeft = dateEndDateTime - DateTime.Now;
				
				// Gets the difference in hours
				int differenceInHours = (int) tsHoursMinsLeft.TotalHours;
				
				// Gets the mins left
				int differenceInMinutes = (int) Math.Ceiling((double)tsHoursMinsLeft.Minutes);
				
				//The message you output
				String msgSpawn2 = "Enjoy BF3s double XP weekend! You have " + differenceInHours + " hour(s) and " + differenceInMinutes + " min(s) left to keep earning double XP!";
				
				// Yells to the player that spawned
				plugin.ServerCommand("admin.yell", msgSpawn2, "10", "player", player.Name);
			}  
	}
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Sorry*:

 

This limit will activate for players who get more than 90% headshots after 30 kills (with a specific weapon). This works across rounds. (Total stats are not reset at the end of the round).

 

Set limit to evaluate OnKill, set action to Kick,

 

Set first_check to this Code:

 

Code:

double kills = player[kill.Weapon].KillsTotal;
         double headshots = player[kill.Weapon].HeadshotsTotal;
         double headshots_percent = Math.Round((headshots / kills)*100.0, 2);
         
         if (headshots_percent > 90 && kills > 30)
         {
             plugin.ConsoleWrite(plugin.R("%p_n% has " + headshots_percent + " headshots percent with "+ kill.Weapon + " after " + kills + " kills"));
             return true;
         }
         
         return false;
Set these action specific parameters:

Code:

kick_message = %p_n%, you were kicked for suspicious headshots percentage with %w_n%
This feature (per-weapon stats) is not extensively tested. You should adjust the conditions to test, and see if it works as you expect it. If you are going to test it on a populated server, make sure it's on virtual so you can adjust the values until you feel comfortable that it will not kick everyone.
Is it possible to add certain weapons to this limit? IE F2000|FAMAS|PP-19 for example. :smile:
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

Is it possible to add certain weapons to this limit? IE F2000|FAMAS|PP-19 for example. :smile:

Please post your request in the Request thread:

 

www.phogue.net/forumvb/showth...imits-Requests*

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Singh400*:

 

Posting this here for my own benefit (easier to track down) and because the questions crops up now and then as well.

 

Different ban types explained:

Code:

//Simple Kick
plugin.KickPlayerWithMessage(player.Name, plugin.R("Reason"));

//EA Ban by player name - permanent ban
plugin.EABanPlayerWithMessage(EABanType.Name, EABanDuration.Permanent, player.Name, 0, "Reason");

//EA Ban by player name - round ban
plugin.EABanPlayerWithMessage(EABanType.Name, EABanDuration.Round, player.Name, 0, "Reason");

//EA Ban by player name - temp ban for 10 minutes
plugin.EABanPlayerWithMessage(EABanType.Name, EABanDuration.Temporary, player.Name, 10, "Reason");

//EA Ban by player IP address - permanent ban
plugin.EABanPlayerWithMessage(EABanType.IPAddress, EABanDuration.Permanent, player.Name, 0, "Reason");

//EA Ban by player IP address - round ban
plugin.EABanPlayerWithMessage(EABanType.IPAddress, EABanDuration.Round, player.Name, 0, "Reason");

//EA Ban by player IP address - temp ban for 10 minutes
plugin.EABanPlayerWithMessage(EABanType.IPAddress, EABanDuration.Temporary, player.Name, 10, "Reason");

//EA Ban by player EA GUID - permanent ban
plugin.EABanPlayerWithMessage(EABanType.EA_GUID, EABanDuration.Permanent, player.Name, 0, "Reason");

//EA Ban by player EA GUID - round ban
plugin.EABanPlayerWithMessage(EABanType.EA_GUID, EABanDuration.Round, player.Name, 0, "Reason");

//EA Ban by player EA GUID - temp ban for 10 minutes
plugin.EABanPlayerWithMessage(EABanType.EA_GUID, EABanDuration.Temporary, player.Name, 10, "Reason");

// PB Ban (all player details recorded) - permanent ban
plugin.PBBanPlayerWithMessage(PBBanDuration.Permanent, player.Name, 0, "Reason");

// PB Ban (all player details recorded) - temp ban for 10 minutes
plugin.PBBanPlayerWithMessage(PBBanDuration.Temporary, player.Name, 10, "Reason");
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

Posting this here for my own benefit (easier to track down) and because the questions crops up now and then as well.

I can do you one better. I copied the post and promoted it to a top level thread, here:

 

www.phogue.net/forumvb/showth...mits-Ban-Types*

* Restored post. It could be that the author is no longer active.
Link to comment
  • 2 weeks later...

Originally Posted by Repoman*:

 

Yes you can. In that case, instead of checking for player count, you just check for what is the current map.

 

Set limit to evaluate OnInterval, and set action to None

 

Set first_check to use this Code snippet:

 

Code:

List<String> map_names = new List<String>();

map_names.Add("MP_003");
map_names.Add("MP_011");

if (map_names.Contains(server.MapFileName))
   plugin.ServerCommand("vars.vehicleSpawnAllowed", "false");
else
  plugin.ServerCommand("vars.vehicleSpawnAllowed", "true");

return false;
For this example, vehicles will be disabled when map is "MP_003", or "MP_011", which are the files names for Tehran Highway, and Seine Crossing. For all other maps, the vehicles will be allowed.

 

This is the full list of map files names for BF3, (including Back to Karkand expansion)

 

  • MP_001 - Grand Bazaar
  • MP_003 - Teheran Highway
  • MP_007 - Caspian Border
  • MP_011 - Seine Crossing
  • MP_012 - Operation Firestorm
  • MP_013 - Damavand Peak
  • MP_017 -Noshahr Canals
  • MP_018 - Kharg Island
  • MP_Subway - Operation Metro
  • XP1_001 - Strike At Karkand
  • Xp1_002 - Gulf of Oman
  • XP1_003 - Sharqi Peninsula
  • XP1_004 - Wake Island

Note that since this only disables the vehicles after the map has loaded, the first set of vehicles might spawn. But, after that, they should not spawn anymore. I haven't tested it to verify, but I suspect that's what would happen.

 

Finally, this is just a very crude way of doing Per-Map settings. Sure it will work, but if there is already a plugin that specializes on that area, and already does the job well, you should use that.

Is OnInterval the same as OnIntervalPlayers? That's all i have in the dropdown list with OnInterval in it.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Singh400*:

 

Is OnInterval the same as OnIntervalPlayers? That's all i have in the dropdown list with OnInterval in it.

Scroll further down, and you will see OnIntervalServer. Select that one.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Repoman*:

 

Scroll further down, and you will see OnIntervalServer. Select that one.

Do I leave evaluation interval set at 30? It didn't mention anything about that for the limit.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Singh400*:

 

Do I leave evaluation interval set at 30? It didn't mention anything about that for the limit.

30-60 should be fine. I'd put it somewhere around 45.

 

As it mentions in the original post, this isn't a very clean way of achieving this. Because during the first load the vehicles will load. It could be achieved a bit more cleanly depending on what other plugins you are using.

 

Also, I think disabling vehicle spawn will change your server from Normal to Custom. Perhaps the solution would be to increase the vehicle respawn time to 1000% or something ridiculous like that.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Repoman*:

 

That was my next question about it going custom. Is the below code right for delay?

 

map_names.Add("MP_001");

map_names.Add("MP_011");

map_names.Add("XP1_001");

 

if (map_names.Contains(server.MapFileName))

plugin.ServerCommand("vars.vehicleSpawnDelay", "99999");

else

plugin.ServerCommand("vars.vehicleSpawnDelay", "99999");

 

return false;

* Restored post. It could be that the author is no longer active.
Link to comment
  • 2 weeks later...

Originally Posted by Mandizzy*:

 

Tried to put in battlelog SPM kicker with this first check expression: ( player.Spm > 1200 )

 

Was running in virtual mode and this player joined in, 1ManZ3rg - the limit kicked but didn't ban cause of virtual mode. Checking player stats, the SPM states 726 !!! Is the SPM even working ? I'm running the .8 patch 3 version.

* Restored post. It could be that the author is no longer active.
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




  • 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.