Jump to content

Insane Limits: Player/Weapon (Sniper) Permission Lottery (not SQDM)


ImportBot

Recommended Posts

Originally Posted by PapaCharlie9*:

 

Version 0.9/R8 (BF4): compiled but not tested. REQUIRES Insane Limits 0.9.16.0 OR LATER!

 

This limit enables players to enter a per-round lottery to get permission to do something that is normally forbidden on the server by this limit. The example below forbids players from using sniper rifles. However, players may enter a lottery and up to 3 entrants per team (customizable) will be selected and allowed to use sniper rifles during the round. Players enter the lottery by typing a command into chat. The lottery runs for 5 minutes (customizable), any entrants after that time limit are ignored. Only one lottery is held per round. The timer and lottery starts when the first player types in the command to be entered into the lottery.

 

For this example, the command is: !sniper

 

This code may be modified to forbid/allow any sort of typical restriction: M320, nades, rockets, Claymores, Mortars, team kills, etc. If you want a modified version, post a request in this thread.

 

Step 1

 

Create a limit to evaluate OnKill, call it "Lotto". Set the Action to None.

 

Set first_check to this Code:

 

Code:

/* VERSION 0.9/R8 (BF4) */

// CUSTOMIZE
double maxMinutes = 5; // Number of minutes to collect players for the lottery
int maxSnipers = 3; // Number of snipers per team to choose from the lottery

String msg = "test";

Action<String> ChatPlayer = delegate(String who) {
    plugin.ServerCommand("admin.yell", msg, "15", "player", who);
    plugin.ServerCommand("admin.say", msg, "player", who);
};

// Use kills to update the lotto time limit
// Means it won't be exact

String kState = "Lotto_State"; // plugin.RoundData int
String kTime = "Lotto_Time"; // plugin.RoundData Object (DateTime)
String kEntries1 = "Lotto_Entries1"; // Team 1: plugin.RoundData Object (List<String>)
String kEntries2 = "Lotto_Entries2"; // Team 2: plugin.RoundData Object (List<String>)
String kPrefix = "Lotto_";
String kWinners = "Lotto_Winners"; // plugin.RoundData String
String key = kPrefix + killer.Name;

int state = 0;
if (plugin.RoundData.issetInt(kState)) state = plugin.RoundData.getInt(kState);

bool sniperRifleUsed = (kill.Category == "SniperRifle");

// State 0: Waiting for first player to type the !sniper command
if (state == 0) {
    if (!sniperRifleUsed) return false;
    // Punish and remind
    msg = "No sniping until after lottery: type !sniper to enter the lottery";
    ChatPlayer(killer.Name); // Remind player
    plugin.KillPlayer(killer.Name, 5);
    plugin.ServerCommand("admin.yell", msg, "8"); // Remind everyone
    return false;
}

// State 1: Running the lotto for maxMinutes
if (state == 1) {
    DateTime start = DateTime.Now;
    if (!plugin.RoundData.issetObject(kTime)) {
        plugin.RoundData.setObject(kTime, (Object)start);
    } else {
        start = (DateTime)plugin.RoundData.getObject(kTime);
    }
    TimeSpan since = DateTime.Now.Subtract(start);
        if (((int)since.TotalSeconds) % 10 == 0) plugin.ConsoleWrite("^b[Lotto]^n Lottery has been running for " + since.TotalSeconds.ToString("F0") + " seconds ...");
    if (since.TotalMinutes < maxMinutes) {
        if (!sniperRifleUsed) return false;
        // Punish and remind
        msg = "No sniping until after lottery: type !sniper to enter the lottery";
        ChatPlayer(killer.Name); // Remind player
        plugin.KillPlayer(killer.Name, 5);
        plugin.ServerCommand("admin.yell", msg, "8"); // Remind everyone
        return false;
    }
    if (!plugin.RoundData.issetObject(kEntries1) && !plugin.RoundData.issetObject(kEntries2)) {
        plugin.ConsoleWrite("^b[Lotto]^n no entrants and time has expired!");
        plugin.RoundData.setInt(kState, 2);
        return false;
    }
    List<String> entrants1 = new List<String>();
        if (plugin.RoundData.issetObject(kEntries1)) entrants1 = (List<String>)plugin.RoundData.getObject(kEntries1);
    List<String> entrants2 = new List<String>();
        if (plugin.RoundData.issetObject(kEntries2)) entrants2 = (List<String>)plugin.RoundData.getObject(kEntries2);
    if (entrants1.Count == 0 && entrants2.Count == 0)  {
        plugin.ConsoleWrite("^b[Lotto]^n no entrants and time has expired!");
        plugin.RoundData.setInt(kState, 2);
        return false;
    }
    msg = "The lottery is over! The winners are:";
    plugin.SendGlobalMessage(msg);
    Random rnd = new Random();
    int pick = maxSnipers;
    // Team 1
    msg = ": may use sniper rifles this round!";
    while (pick > 0 && entrants1.Count > 0) {
        int winner = (entrants1.Count > 2) _ rnd.Next(entrants1.Count) : 0;
        String name = entrants1[winner];
        entrants1.RemoveAt(winner);
        key = kPrefix + name;
        plugin.RoundData.setBool(key, true);
        msg = name + msg;
        --pick;
        if (pick > 0) msg = ", " + msg;
    }
    // Team 2
    pick = maxSnipers;
    if (entrants2.Count > 0) msg = ", " + msg;
    while (pick > 0 && entrants2.Count > 0) {
        int winner = (entrants2.Count > 2) _ rnd.Next(entrants2.Count) : 0;
        String name = entrants2[winner];
        entrants2.RemoveAt(winner);
        key = kPrefix + name;
        plugin.RoundData.setBool(key, true);
        msg = name + msg;
        --pick;
        if (pick > 0) msg = ", " + msg;
    }
    plugin.SendGlobalMessage(msg);
    plugin.ServerCommand("admin.yell", msg, "15");
    plugin.ConsoleWrite("^b[Lotto]^n " + msg);
        plugin.RoundData.setString(kWinners, msg);

    plugin.RoundData.setInt(kState, 2);
    return false;
}

// State 2: Lottery is over, only winners may use sniper rifles
if (state == 2) {
    if (sniperRifleUsed && !plugin.RoundData.issetBool(key)) {
        msg = killer.Name + ": You are not allowed to use sniper rifles this round!";
        ChatPlayer(killer.Name);
        plugin.KillPlayer(killer.Name, 5);
        return false;    
    }
}

return false;
NOTE: Older BF4 list of sniper weapons, if you can't run Insane Limits 0.9.16.0 (why not_)

(AMR2|AMR2_MED|CS-LR4|FY-JS|GalilACE53|JNG90|L96|M200|M39EBR|M40A5|M82A3|M8 2A3_CQB|M82A3_MED|M98B|MK11|QBU88|RFB|SCAR-HSV|Scout|SKS|SRS|SV98|SVD12)

 

NOTE: Older BF3 list of sniper weapons, if you want BF3:

(_:JNG90|M417|L96|M39|M40A5|Mk11|Model98B|QBU-88|SKS|SV98|SVD)

 

Step 2

 

Create a limit to evaluate OnAnyChat, call it "Lotto Command". Set Action to None.

 

Set first_check to this Code:

 

Code:

/* VERSION 0.9/R7 BF4 */
// CUSTOMIZE
double maxMinutes = 5; // Number of minutes to collect players for the lottery

String kWinners = "Lotto_Winners"; // plugin.RoundData String

if (Regex.Match(player.LastChat, @"(snipers|winners|list)", RegexOptions.IgnoreCase).Success) {
    if (plugin.RoundData.issetString(kWinners)) {
        plugin.SendGlobalMessage("This round's snipers: " + plugin.RoundData.getString(kWinners));
        return false;
    }
}

if (!Regex.Match(player.LastChat, @"^\s*!sniper_", RegexOptions.IgnoreCase).Success) return false;

String msg = "test";

Action<String> ChatPlayer = delegate(String who) {
    plugin.ServerCommand("admin.yell", msg, "15", "player", who);
    plugin.ServerCommand("admin.say", msg, "player", who);
};

String kState = "Lotto_State"; // plugin.RoundData int
String kEntries1 = "Lotto_Entries1"; // Team 1: plugin.RoundData Object (List<String>)
String kEntries2 = "Lotto_Entries2"; // Team 2: plugin.RoundData Object (List<String>)

int state = 0;
if (!plugin.RoundData.issetInt(kState)) {
    plugin.RoundData.setInt(kState, 0); // Waiting for the first entrant
} else {
    state = plugin.RoundData.getInt(kState);
}

// Got another entrant!

if (state == 0) {
    msg = "The sniper rifle lottery will run for " + maxMinutes + " minutes. Type !sniper to enter!";
    plugin.SendGlobalMessage(msg);
    plugin.ServerCommand("admin.yell", msg, "8");
    plugin.ConsoleWrite("^b[Lotto]^n " + msg);
    plugin.RoundData.setInt(kState, 1);
    state = 1;
}

if (state == 2) {
    msg = "The lottery is over for this round. No more entries allowed.";
    ChatPlayer(player.Name);
    return false;
}

// Otherwise, we are State 1: running the lotto and taking names

msg = "You already entered the sniper rifle lottery!";

if (player.TeamId == 1) {
    List<String> entrants1 = null;
    if (!plugin.RoundData.issetObject(kEntries1)) {
        entrants1 = new List<String>();
        plugin.RoundData.setObject(kEntries1, (Object)entrants1);
    } else {
        entrants1 = (List<String>)plugin.RoundData.getObject(kEntries1);
    }
        if (!entrants1.Contains(player.Name)) {
        entrants1.Add(player.Name);
        msg = "You are the #" + entrants1.Count + " entrant in the sniper rifle lottery!";
        }
} else if (player.TeamId == 2) {
    List<String> entrants2 = null;
    if (!plugin.RoundData.issetObject(kEntries2)) {
        entrants2 = new List<String>();
        plugin.RoundData.setObject(kEntries2, (Object)entrants2);
    } else {
        entrants2 = (List<String>)plugin.RoundData.getObject(kEntries2);
    }
        if (!entrants2.Contains(player.Name)) {
        entrants2.Add(player.Name);
        msg = "You are the #" + entrants2.Count + " entrant in the sniper rifle lottery!";
        }
}

ChatPlayer(player.Name);
plugin.ConsoleWrite("^b[Lotto]^n (" + player.Name + "): " + msg);
return false;
OPTIONAL

 

If you want to prevent players from entering the lottery between rounds and possibly getting double entries/cheating, add this third limit:

 

Create a new limit OnRoundStart, called "Plug Lotto Hole", leave Action set to None.

 

Set first_check to this Code:

 

Code:

String kState = "Lotto_State"; // plugin.RoundData int
String kEntries1 = "Lotto_Entries1"; // Team 1: plugin.RoundData Object (List<String>)
String kEntries2 = "Lotto_Entries2"; // Team 2: plugin.RoundData Object (List<String>)

if (plugin.RoundData.issetInt(kState)) plugin.RoundData.unsetInt(kState);
if (plugin.RoundData.issetObject(kEntries1)) plugin.RoundData.unsetObject(kEntries1);
if (plugin.RoundData.issetObject(kEntries2)) plugin.RoundData.unsetObject(kEntries2);
String msg = "All Lotto entries have been cleared!";
plugin.ConsoleWrite(msg);
plugin.SendGlobalMessage(msg);
return false;
Keywords: weapon limiter, Xtrem Weapon Limiter alternative, USAS, sniper
* Restored post. It could be that the author is no longer active.
Link to comment
  • Replies 125
  • Created
  • Last Reply
  • 1 month later...

Originally Posted by glenn82*:

 

Version 0.8/R2: compiled but not tested.

 

This limit enables players to enter a per-round lottery to get permission to do something that is normally forbidden on the server by this limit. The example below forbids players from using sniper rifles. However, players may enter a lottery and up to 3 entrants per team (customizable) will be selected and allowed to use sniper rifles during the round. Players enter the lottery by typing a command into chat. The lottery runs for 5 minutes (customizable), any entrants after that time limit are ignored. Only one lottery is held per round. The timer and lottery starts when the first player types in the command to be entered into the lottery.

 

For this example, the command is: !sniper

 

This code may be modified to forbid/allow any sort of typical restriction: M320, nades, rockets, Claymores, Mortars, team kills, etc. If you want a modified version, post a request in this thread.

 

Step 1

 

Create a limit to evaluate OnKill, call it "Lotto". Set the Action to None.

 

Set first_check to this Code:

 

Code:

/* VERSION 0.8/R2 */

// CUSTOMIZE
double maxMinutes = 5; // Number of minutes to collect players for the lottery
int maxSnipers = 3; // Number of snipers per team to choose from the lottery

String msg = "test";

Action<String> ChatPlayer = delegate(String who) {
	plugin.ServerCommand("admin.yell", msg, "15", "player", who);
	plugin.ServerCommand("admin.say", msg, "player", who);
};

// Use kills to update the lotto time limit
// Means it won't be exact

String kState = "Lotto_State"; // plugin.RoundData int
String kTime = "Lotto_Time"; // plugin.RoundData Object (DateTime)
String kEntries1 = "Lotto_Entries1"; // Team 1: plugin.RoundData Object (List<String>)
String kEntries2 = "Lotto_Entries2"; // Team 2: plugin.RoundData Object (List<String>)
String kPrefix = "Lotto_";
String key = kPrefix + killer.Name;

int state = 0;
if (plugin.RoundData.issetInt(kState)) state = plugin.RoundData.getInt(kState);

bool sniperRifleUsed = Regex.Match(kill.Weapon, @"(_:JNG90|M417|L96|M39|M40A5|Mk11|Model98B|QBU-88|SKS|SV98|SVD)", RegexOptions.IgnoreCase).Success;

// State 0: Waiting for first player to type the !sniper command
if (state == 0) {
	if (!sniperRifleUsed) return false;
	// Punish and remind
	msg = "No sniping until after lottery: type !sniper to enter the lottery";
	ChatPlayer(killer.Name); // Remind player
	plugin.KillPlayer(killer.Name, 5);
	plugin.ServerCommand("admin.yell", msg, "8"); // Remind everyone
	return false;
}

// State 1: Running the lotto for maxMinutes
if (state == 1) {
	DateTime start = DateTime.Now;
	if (!plugin.RoundData.issetObject(kTime)) {
		plugin.RoundData.setObject(kTime, (Object)start);
	} else {
		start = (DateTime)plugin.RoundData.getObject(kTime);
	}
	TimeSpan since = DateTime.Now.Subtract(start);
	if (since.TotalMinutes < maxMinutes) {
		if (!sniperRifleUsed) return false;
		// Punish and remind
		msg = "No sniping until after lottery: type !sniper to enter the lottery";
		ChatPlayer(killer.Name); // Remind player
		plugin.KillPlayer(killer.Name, 5);
		plugin.ServerCommand("admin.yell", msg, "8"); // Remind everyone
		return false;
	}
	if (!plugin.RoundData.issetObject(kEntries1) && !plugin.RoundData.issetObject(kEntries2)) {
		plugin.ConsoleWrite("^b[Lotto]^n no entrants and time has expired!");
		plugin.RoundData.setInt(kState, 2);
		return false;
	}
	List<String> entrants1 = (List<String>)plugin.RoundData.getObject(kEntries1);
	List<String> entrants2 = (List<String>)plugin.RoundData.getObject(kEntries2);
	if (entrants1.Count == 0 && entrants2.Count == 0)  {
		plugin.ConsoleWrite("^b[Lotto]^n no entrants and time has expired!");
		plugin.RoundData.setInt(kState, 2);
		return false;
	}
	msg = "The lottery is over! The winners are:";
	plugin.SendGlobalMessage(msg);
	Random rnd = new Random();
	int pick = maxSnipers;
	// Team 1
	msg = ": may use sniper rifles this round!";
	while (pick > 0 && entrants1.Count > 0) {
		int winner = (entrants1.Count > 2) _ rnd.Next(entrants1.Count) : 0;
		String name = entrants1[winner];
		entrants1.RemoveAt(winner);
		key = kPrefix + name;
		plugin.RoundData.setBool(key, true);
		msg = name + msg;
		--pick;
		if (pick > 0) msg = ", " + msg;
	}
	// Team 2
	pick = maxSnipers;
	if (entrants2.Count > 0) msg = ", " + msg;
	while (pick > 0 && entrants2.Count > 0) {
		int winner = (entrants2.Count > 2) _ rnd.Next(entrants2.Count) : 0;
		String name = entrants2[winner];
		entrants2.RemoveAt(winner);
		key = kPrefix + name;
		plugin.RoundData.setBool(key, true);
		msg = name + msg;
		--pick;
		if (pick > 0) msg = ", " + msg;
	}
	plugin.SendGlobalMessage(msg);
	plugin.ServerCommand("admin.yell", msg, "15");
	plugin.ConsoleWrite("^b[Lotto]^n " + msg);

	plugin.RoundData.setInt(kState, 2);
	return false;
}

// State 2: Lottery is over, only winners may use sniper rifles
if (state == 2) {
	if (sniperRifleUsed && !plugin.RoundData.issetBool(key)) {
		msg = "You are not allowed to use sniper rifles this round!";
		ChatPlayer(killer.Name);
		plugin.KillPlayer(killer.Name, 5);
		return false;	
	}
}

return false;
Step 2

 

Create a limit to evaluate OnAnyChat, call it "Lotto Command". Set Action to None.

 

Set first_check to this Code:

 

Code:

/* VERSION 0.8/R2 */
// CUSTOMIZE
double maxMinutes = 5; // Number of minutes to collect players for the lottery

if (!Regex.Match(player.LastChat, @"^\s*!sniper_", RegexOptions.IgnoreCase).Success) return false;

String msg = "test";

Action<String> ChatPlayer = delegate(String who) {
	plugin.ServerCommand("admin.yell", msg, "15", "player", who);
	plugin.ServerCommand("admin.say", msg, "player", who);
};

String kState = "Lotto_State"; // plugin.RoundData int
String kEntries1 = "Lotto_Entries1"; // Team 1: plugin.RoundData Object (List<String>)
String kEntries2 = "Lotto_Entries2"; // Team 2: plugin.RoundData Object (List<String>)

int state = 0;
if (!plugin.RoundData.issetInt(kState)) {
	plugin.RoundData.setInt(kState, 0); // Waiting for the first entrant
} else {
	state = plugin.RoundData.getInt(kState);
}

// Got another entrant!

if (state == 0) {
	msg = "The sniper rifle lottery will run for " + maxMinutes + " minutes. Type !sniper to enter!";
	plugin.SendGlobalMessage(msg);
	plugin.ServerCommand("admin.say", msg);
	plugin.ConsoleWrite("^b[Lotto]^n " + msg);
	plugin.RoundData.setInt(kState, 1);
	state = 1;
}

if (state == 2) {
	msg = "The lottery is over for this round. No more entries allowed.";
	ChatPlayer(player.Name);
	return false;
}

// Otherwise, we are State 1: running the lotto and taking names

if (player.TeamId == 1) {
	List<String> entrants1 = null;
	if (!plugin.RoundData.issetObject(kEntries1)) {
		entrants1 = new List<String>();
		plugin.RoundData.setObject(kEntries1, (Object)entrants1);
	} else {
		entrants1 = (List<String>)plugin.RoundData.getObject(kEntries1);
	}
	entrants1.Add(player.Name);
	msg = "You are the #" + entrants1.Count + " entrant in the sniper rifle lottery!";
} else if (player.TeamId == 2) {
	List<String> entrants2 = null;
	if (!plugin.RoundData.issetObject(kEntries2)) {
		entrants2 = new List<String>();
		plugin.RoundData.setObject(kEntries2, (Object)entrants2);
	} else {
		entrants2 = (List<String>)plugin.RoundData.getObject(kEntries2);
	}
	entrants2.Add(player.Name);
	msg = "You are the #" + entrants2.Count + " entrant in the sniper rifle lottery!";
}

ChatPlayer(player.Name);
plugin.ConsoleWrite("^b[Lotto]^n (" + player.Name + "): " + msg);
return false;
Keywords: weapon limiter, Xtrem Weapon Limiter alternative, USAS, sniper
hey papacharlie9

 

can this limit be done without the lotto?

just the sniperlimit with a limit of 2 sniperrifles per team?

 

ohw by the way the limit gifs a error

 

of type 'System.Object' to type 'System.Collections.Generic.List`1[system.String]'.

[20:19:55 27] [insane Limits] Extra information dumped in file InsaneLimits.dump

[20:19:57 32] [insane Limits] ERROR: DataDictionary has no Object(Lotto_Entries1) key

[20:19:57 33] [insane Limits] EXCEPTION: LimitEvaluator2: System.InvalidCastException: Unable to cast object of type 'System.Object' to type 'System.Collections.Generic.List`1[system.String]'.

[20:19:57 33] [insane Limits] Extra information dumped in file InsaneLimits.dump

[20:19:57 93] [insane Limits] ERROR: DataDictionary has no Object(Lotto_Entries1) key

[20:19:57 93] [insane Limits] EXCEPTION: LimitEvaluator2: System.InvalidCastException: Unable to cast object of type 'System.Object' to type 'System.Collections.Generic.List`1[system.String]'.

[20:19:57 93] [insane Limits] Extra information dumped in file InsaneLimits.dump

 

greets glenn

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

Originally Posted by HexaCanon*:

 

hey papacharlie9

 

can this limit be done without the lotto?

just the sniperlimit with a limit of 2 sniperrifles per team?

 

ohw by the way the limit gifs a error

 

of type 'System.Object' to type 'System.Collections.Generic.List`1[system.String]'.

[20:19:55 27] [insane Limits] Extra information dumped in file InsaneLimits.dump

[20:19:57 32] [insane Limits] ERROR: DataDictionary has no Object(Lotto_Entries1) key

[20:19:57 33] [insane Limits] EXCEPTION: LimitEvaluator2: System.InvalidCastException: Unable to cast object of type 'System.Object' to type 'System.Collections.Generic.List`1[system.String]'.

[20:19:57 33] [insane Limits] Extra information dumped in file InsaneLimits.dump

[20:19:57 93] [insane Limits] ERROR: DataDictionary has no Object(Lotto_Entries1) key

[20:19:57 93] [insane Limits] EXCEPTION: LimitEvaluator2: System.InvalidCastException: Unable to cast object of type 'System.Object' to type 'System.Collections.Generic.List`1[system.String]'.

[20:19:57 93] [insane Limits] Extra information dumped in file InsaneLimits.dump

 

greets glenn

how do you want to specify the player who gets to use the sniper ?
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

hey papacharlie9

 

can this limit be done without the lotto?

just the sniperlimit with a limit of 2 sniperrifles per team?

 

ohw by the way the limit gifs a error

 

of type 'System.Object' to type 'System.Collections.Generic.List`1[system.String]'.

[20:19:55 27] [insane Limits] Extra information dumped in file InsaneLimits.dump

[20:19:57 32] [insane Limits] ERROR: DataDictionary has no Object(Lotto_Entries1) key

[20:19:57 33] [insane Limits] EXCEPTION: LimitEvaluator2: System.InvalidCastException: Unable to cast object of type 'System.Object' to type 'System.Collections.Generic.List`1[system.String]'.

[20:19:57 33] [insane Limits] Extra information dumped in file InsaneLimits.dump

[20:19:57 93] [insane Limits] ERROR: DataDictionary has no Object(Lotto_Entries1) key

[20:19:57 93] [insane Limits] EXCEPTION: LimitEvaluator2: System.InvalidCastException: Unable to cast object of type 'System.Object' to type 'System.Collections.Generic.List`1[system.String]'.

[20:19:57 93] [insane Limits] Extra information dumped in file InsaneLimits.dump

 

greets glenn

I just tested it and it works fine for me. Are you sure you have .Net 3.5 or later installed? It looks like you don't.

 

No, this limit is all about the lottery. If you just want first come, first served (which gives it to the fastest joiners, which means the same two guys will get it every round if they want it, kinda unfair), use this ProconRulz instead:

 

www.phogue.net/forumvb/showth...r-by-Tarreltje*

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

Originally Posted by glenn82*:

 

I just tested it and it works fine for me. Are you sure you have .Net 3.5 or later installed? It looks like you don't.

 

No, this limit is all about the lottery. If you just want first come, first served (which gives it to the fastest joiners, which means the same two guys will get it every round if they want it, kinda unfair), use this ProconRulz instead:

 

www.phogue.net/forumvb/showth...r-by-Tarreltje*

net 3.5 i dont know my procons ar hosted on the same servers as the gameservers

 

on on my comp i have it installed

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

Originally Posted by PapaCharlie9*:

 

Found a bug whilst experimenting with it on BF4, one can entry as much as he would like and thus increasing his chances to win the lottery.

Indeed, you are correct. That is a defect. I have fixed it in post #1, thanks for catching that.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by TheHawk1337*:

 

Indeed, you are correct. That is a defect. I have fixed it in post #1, thanks for catching that.

Wow thanks for the quick reply :smile:

I was (as amateur C# coder) looking into it as well, with no result. I will look how you did it though :smile:

 

Thanks!

 

I have another question/possible bug (testing soon):

 

If nobody types !sniper, does the lottery even start? Because nobody can be forced to type !sniper and if nobody does it everybody can snipe (if the lottery doesn't start ofcourse).

 

EDIT: Nevermind the above, works like a charm :smile:

 

EDIT: Sadly, it doesn't. It doesn't actually pick the snipers now, it just keeps the lottery open.

 

EDIT: I don't know exactly how your timing system works, but I am testing this alone or with 2 players. Could this be the problem (perhaps too little kills or something like that_)

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

Originally Posted by PapaCharlie9*:

 

It should work if you change the weapon names in the script, but I can't get it working on my server. It starts the lottery but it doesn't pick any winners...

Try it now. All I did was replace the BF3 sniper weapon codes with the BF4 codes, which anyone could have done.

 

There's nothing sacred about this stuff. I'm busy fixing the plugin itself, so rather than wait for me to have time, find other people to help. There are usually 1 or 2 others in this forum that can make simple code changes, like this one. They normally post a reply with a code change. Even better, try it yourself and learn a new skill!

 

EDIT: I added some logging that will show how many seconds the lottery has been running. Once the lotto has started (someone typed !sniper), every time anyone kills anyone else with any weapon, you should see a log entry in the Plugin window that looks like this:

 

[Lotto] Lottery has been running for 5 seconds ...

[Lotto] Lottery has been running for 6 seconds ...

[Lotto] Lottery has been running for 8 seconds ...

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

Originally Posted by TheHawk1337*:

 

I already replaced the weapon names (it was working when I posted about the unlimited entries bug). I am currently figuring out how your script works, after which I can experiment a bit myself. As amateur coder who is following classes since 10 weeks it's rather complicated :ohmy: Didn't mean to offend you tho. I greatly appreciate your help, I only PMd you because I thought you missed my edited post.

 

EDIT: Nice! That timer will help a lot in testing! Will test as soon as I get home :smile:

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

Originally Posted by PapaCharlie9*:

 

I already replaced the weapon names (it was working when I posted about the unlimited entries bug). I am currently figuring out how your script works, after which I can experiment a bit myself. As amateur coder who is following classes since 10 weeks it's rather complicated :ohmy: Didn't mean to offend you tho. I greatly appreciate your help, I only PMd you because I thought you missed my edited post.

 

EDIT: Nice! That timer will help a lot in testing! Will test as soon as I get home :smile:

No offense taken. I'm just super busy and hate to let you guys down with your requests.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by TheHawk1337*:

 

Good to hear (that you took no offense :ohmy: ). I can understand that you are busy looking at the amount of plugins you have to manage (and I assume you also have a daytime job in coding).

 

Got some little questions about your code:

Why exactly do you use double negatives in your code? For instance: you check for !sniperrifleused.succes to return a false. Why not sniperrifleused.succes return true? (just curious :smile: )

 

I see A LOT of if statements, woulden't a switch be handier?

 

Am I correct that this is C# code mixed with some php code?

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

Originally Posted by PapaCharlie9*:

 

Good to hear (that you took no offense :ohmy: ). I can understand that you are busy looking at the amount of plugins you have to manage (and I assume you also have a daytime job in coding).

 

Got some little questions about your code:

Why exactly do you use double negatives in your code? For instance: you check for !sniperrifleused.succes to return a false. Why not sniperrifleused.succes return true? (just curious :smile: )

 

I see A LOT of if statements, woulden't a switch be handier?

 

Am I correct that this is C# code mixed with some php code?

It's 100% C#.

 

Switch only works for constant value equality, like int or String. If there are bool expressions, particularly function calls, needed, if statements are the best choice.

 

The limit has to return false to avoid triggering the action logic, since there is no action specified. So everything is dictated by that requirement. Also, I only want to return if the expression is not true, that is, if someone used a weapon that is NOT a sniper rifle. If they did use a sniper rifle, I don't want to return. Basically, it means, keep going if the kill was with a sniper rifle, otherwise, skip the rest of the code and return false immediately.

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

Originally Posted by PapaCharlie9*:

 

Ok clears up a lot of things. Thanks!

 

Didn't know isset was part of c#. Will look into that. :smile:

It's not, that's part of the Insane Limits plugin API. Look at the Insane Limits #1 post for API details.

 

Good news is that I just tested the limit on the Procon test server and it works as expected. The bad news is that the logging is too spammy. So I changed it so that it only logs every 10 seconds. Make sure you pick up R5.

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

Originally Posted by TheHawk1337*:

 

[21:03:17 16] [insane Limits] Thread(fetch): DONE inserting 1 new players, 0 still in queue, took a total of 1 secs

[21:04:46 68] [insane Limits] [Lotto] The sniper rifle lottery will run for 5 minutes. Type !sniper to enter!

[21:04:46 68] [insane Limits] [Lotto] (Freekers): You are the #1 entrant in the sniper rifle lottery!

[21:10:02 19] [insane Limits] [Lotto] Lottery has been running for 0 seconds ...

 

This was R4, will test R5 now.

 

Same with R5:

 

[21:14:01 73] [insane Limits] [Lotto] The sniper rifle lottery will run for 2 minutes. Type !sniper to enter!

[21:14:01 73] [insane Limits] [Lotto] (Freekers): You are the #1 entrant in the sniper rifle lottery!

[21:14:05 47] [insane Limits] [Lotto] Lottery has been running for 0 seconds ...

 

I see that there are 2 maxminutes. Do I have to change both or just one?

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

Originally Posted by phrogz*:

 

FYI it works but there is one error sometimes, i'll try to solve it by myself:

 

[23:56:26 76] [insane Limits] Extra information dumped in file InsaneLimits.dump

[23:56:27 29] [insane Limits] [Lotto] Lottery has been running for 1632 seconds ...

[23:56:27 29] [insane Limits] ERROR: DataDictionary has no Object(Lotto_Entries2) key

[23:56:27 29] [insane Limits] EXCEPTION: LimitEvaluator1: System.InvalidCastException: Impossible d'effectuer un cast d'un objet de type 'System.Object' en type 'System.Collections.Generic.List`1[system.String]'.

[23:56:27 31] [insane Limits] Extra information dumped in file InsaneLimits.dump

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

Originally Posted by TheHawk1337*:

 

FYI it works but there is one error sometimes, i'll try to solve it by myself:

With how many players did you test? I currently test with only 2 players, perhaps that's the issue because the match is not running then.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

I meant with 'issue' the reason why it's not working at my server. I have no idea what gives the error on yours.

You need to have kill events, which does not include suicides. You need a running round and enough players for soldiers to be killed to advance the clock.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

FYI it works but there is one error sometimes, i'll try to solve it by myself:

This is most likely a copy/paste error. Try pasting the code again. Are you using Internet Explorer? That is known to cause copy/paste errors. If you can, try a different browser.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by jking54*:

 

Seems to be running well and has players wondering wtf it is, though no real hard core complaints :smile:

 

Question, how do you use the mail function? I entered my info into the custom SMTP, but what then?

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

Originally Posted by jking54*:

 

Getting this error:

 

[16:49:37 10] [insane Limits] +++ Evaluating all Kill limits ...

[16:49:37 12] [insane Limits] ERROR: DataDictionary has no Object(Lotto_Entries1) key

[16:49:37 12] [insane Limits] EXCEPTION: LimitEvaluator1: System.InvalidCastException: Unable to cast object of type 'System.Object' to type 'System.Collections.Generic.List`1[system.String]'.

[16:49:37 13] [insane Limits] Extra information dumped in file InsaneLimits.dump

[16:49:37 13] [insane Limits] +++ Evaluated 1 limits

 

[16:51:27 38] [insane Limits] +++ Evaluating all Spawn limits ...

[16:51:27 38] [insane Limits] +++ Evaluated 0 limits

[16:51:27 65] [insane Limits] +++ Evaluating all Kill limits ...

[16:51:27 66] [insane Limits] ERROR: DataDictionary has no Object(Lotto_Entries1) key

[16:51:27 67] [insane Limits] EXCEPTION: LimitEvaluator1: System.InvalidCastException: Unable to cast object of type 'System.Object' to type 'System.Collections.Generic.List`1[system.String]'.

[16:51:27 67] [insane Limits] Extra information dumped in file InsaneLimits.dump

[16:51:27 67] [insane Limits] +++ Evaluated 1 limits

 

dumping these errors left and right now, what's up?

* Restored post. It could be that the author is no longer active.
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.