Jump to content

Insane Limits V0.8/R3: !pistols on/off command


ImportBot

Recommended Posts

Originally Posted by PapaCharlie9*:

 

Version 0.0.8/R3: compiles, tested on BF4

 

These two limits allow you to change between pistols-only mode and regular mode within a round by using an in-game command. Only players whose names or tags you include in a custom admins list are allowed to use the command. When the mode is on, any kills done with a weapon other than a pistol will result in first a warning kill, then a warning kick, then a temporary ban.

 

The command are:

 

!pistols on - turns pistol's only mode on

 

!pistols off - turns pistol's only mode off

 


 

STEP 1

 

Create a custom list called admins if you don't have one already. Set it Enabled and set the comparison to CaseSensitive. Set its value to a comma separated list of player names or tags. If a player's name or tag matches any on the list, they be able to use the command.

 

STEP 2

 

Create a limit to evaluate OnAnyChat and call it "Pistol command". Leave Action set to None.

 

Set first_check to this Code:

 

Code:

/* VERSION R4 */

String kPistols = "Pistols only toggle"; // plugin.Data bool
bool isPistolsOnly = false;

String tag = player.Tag;
if (tag.Length == 0) {
	// Maybe they are using [_-=]XXX[=-_]PlayerName format
	Match tm = Regex.Match(player.Name, @"^[=_\-]_([^=_\-]{2,4})[=_\-]");
	if (tm.Success) {
		tag = tm.Groups[1].Value;
	} else {
		tag = "no tag";
	}
}

if (!plugin.isInList(player.Name, "admins") && !plugin.isInList(tag, "admins")) return false;

Match m = Regex.Match(player.LastChat, @"^\s*!pistols_\s+(on|off)", RegexOptions.IgnoreCase);

if (!m.Success) return false;

String mode = m.Groups[1].Value;

if (mode == "on") {
	isPistolsOnly = true;
} else if (mode == "off") {
	isPistolsOnly = false;
}

if (isPistolsOnly) {
	plugin.SendGlobalMessage("*** PISTOLS ONLY MODE IS ON! ***");
	plugin.ServerCommand("admin.yell", "PISTOLS ONLY STARTING NOW!");
} else {
	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);

	foreach (PlayerInfoInterface p in all) {
		String kCounter = p.Name + "_TreatAsOne_Count_Pistol";
		if (server.Data.issetInt(kCounter)) server.Data.unsetInt(kCounter);
	}
	plugin.SendGlobalMessage("*** PISTOLS ONLY MODE IS OFF! ***");
	plugin.ServerCommand("admin.yell", "You can use any weapon now, no more pistols only");
}

plugin.Data.setBool(kPistols, isPistolsOnly);

return false;
Leave second_check Disabled.

 

STEP 3

 

Create a limit to evaluate OnKill and call it "Pistol kill". Leave Action set to None.

 

Set first_check to this Expression:

 

Code:

(true)
For Insane Limits 0.9.16.0 or later, use this code instead of the list of weapon codes:

 

Find the line of code that has the BF4 pistol codes:

 

Code:

if (!isPistolsOnly || Regex.Match(kill.Weapon, @"(_:U_Taurus44|U_HK45C|U_CZ75|U_FN57|U_M1911|U_M9 |U_MP412Rex|U_MP443|U_P226|U_QSZ92)", RegexOptions.IgnoreCase).Success) return false;
Change it to this:

 

Code:

if (!isPistolsOnly || kill.Category == "Handgun") return false;
For shotguns instead of pistols only, use this:

 

Code:

if (!isPistolsOnly || kill.Category == "Shotgun") return false;
For Insane Limits before 0.9.16.0: THIS USES BF4 PISTOL CODES: U_Taurus44|U_HK45C|U_CZ75|U_FN57|U_M1911|U_M9 |U_MP412Rex|U_MP443|U_P226|U_QSZ92

 

Old BF3 pistol codes: M1911|M9|Taurus|MP412REX|MP443|Glock

 

Set second_checkto this Code:

 

Code:

/* VERSION R4 */

if (killer.Name == victim.Name) return false; // don't punish Suicides

if (Regex.Match(kill.Weapon, @"(_:SoldierCollision|DamageArea|Suicide|RoadKill)", RegexOptions.IgnoreCase).Success) return false; // don't punish weird death cases

String kPistols = "Pistols only toggle"; // plugin.Data bool
bool isPistolsOnly = false;

if (plugin.Data.issetBool(kPistols)) isPistolsOnly = plugin.Data.getBool(kPistols);

if (!isPistolsOnly || Regex.Match(kill.Weapon, @"(_:U_Taurus44|U_HK45C|U_CZ75|U_FN57|U_M1911|U_M9 |U_MP412Rex|U_MP443|U_P226|U_QSZ92)", RegexOptions.IgnoreCase).Success) return false;

String kCounter = killer.Name + "_TreatAsOne_Count_Pistol";
TimeSpan time = TimeSpan.FromSeconds(1); // Activations within 1 seconds count as 1
    
int warnings = 0;
if (server.Data.issetInt(kCounter)) warnings = server.Data.getInt(kCounter);

/*
The first time through, warnings is zero. Whether this is an isolated
activation or the first of a sequence of activations in a short period
of time, do something on this first time through.
*/
String msg = "none";
if (warnings == 0) {
        msg = "We are playing pistols only!";
        plugin.ServerCommand("admin.say", "FINAL WARNING " + killer.Name + "! " + msg, "player", killer.Name);
        plugin.ServerCommand("admin.yell", msg, "15", "player", killer.Name);
        plugin.PRoConChat("ADMIN to " + killer.Name + "> " + msg);
	plugin.KillPlayer(killer.Name, 5);
        server.Data.setInt(kCounter, warnings+1);
        return false;
}

/*
The second and subsequent times through, check to make sure we are not
getting multiple activations in a short period of time. Ignore if
less than the time span required.
*/

if (limit.Activations(killer.Name, time) > 1) return false;

/*
We get here only if there was exactly one activation in the time span
*/

if (warnings == 1) {
        msg = "Pistols only, next time you are banned!";
        plugin.ServerCommand("admin.say", "FINAL WARNING " + killer.Name + "!" + msg, "player", killer.Name);
        plugin.ServerCommand("admin.yell", msg, "10", "player", killer.Name);
        plugin.PRoConChat("ADMIN to " + killer.Name + ">" + msg);
        plugin.KickPlayerWithMessage(killer.Name, msg);
} else {
        msg = "Temp banning " + killer.Name + " for not using a pistol";
        plugin.SendGlobalMessage(msg);
        plugin.ServerCommand("admin.yell", msg);
        plugin.PRoConChat("ADMIN > " + msg);
        plugin.PRoConEvent(msg, "Insane Limits");
	plugin.EABanPlayerWithMessage(EABanType.Name, EABanDuration.Temporary, killer.Name, 10, msg);
}
server.Data.setInt(kCounter, warnings+1);
return false;
* Restored post. It could be that the author is no longer active.
Link to comment
  • Replies 86
  • Created
  • Last Reply

Originally Posted by pharbehind*:

 

[22:39:21 59] [insane Limits] Compiling Limit #5 - Pistol Kill - OnKill

[22:39:21 63] [insane Limits] ERROR: 1 error compiling Code

[22:39:21 63] [insane Limits] ERROR: (CS1002, line: 81, column: 107): ; expected

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

Originally Posted by PapaCharlie9*:

 

[22:39:21 59] [insane Limits] Compiling Limit #5 - Pistol Kill - OnKill

[22:39:21 63] [insane Limits] ERROR: 1 error compiling Code

[22:39:21 63] [insane Limits] ERROR: (CS1002, line: 81, column: 107): ; expected

Ok, I fixed that one, but there might be more. I haven't had a chance to check it myself and I probably won't for a few days.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Tomgun*:

 

could it be possible to add to the script that if someone joins the server whos tags name is not in a whitelist it turns off automaticlly

 

reason being ive going on only enable this for the officers who run the bf3 wing im in to turn it on and off but not the clanmembers so they can play it for fun but as soon as a public person spawns it turns off automaticlly?

 

is that possible?

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

Originally Posted by PapaCharlie9*:

 

could it be possible to add to the script that if someone joins the server whos tags name is not in a whitelist it turns off automaticlly

 

reason being ive going on only enable this for the officers who run the bf3 wing im in to turn it on and off but not the clanmembers so they can play it for fun but as soon as a public person spawns it turns off automaticlly?

 

is that possible?

Yes. Add this additional limit (STEP 4).

 

Create a limit to evaluate OnSpawn, call it "Pistol spawn". Set Action to None.

 

Set first_check to this Code:

 

Code:

/* VERSION 0.8/R1 */
String kPistols = "Pistols only toggle"; // plugin.Data bool

String tag = player.Tag;
if (tag.Length == 0) {
	// Maybe they are using [_-=]XXX[=-_]PlayerName format
	Match tm = Regex.Match(player.Name, @"^[=_\-]_([^=_\-]{2,4})[=_\-]");
	if (tm.Success) {
		tag = tm.Groups[1].Value;
	} else {
		tag = "no tag";
	}
}

if (!plugin.isInList(player.Name, "admins") && !plugin.isInList(tag, "admins")) {
	bool wasOn = plugin.Data.issetBool(kPistols);
        if (wasOn) wasOn = plugin.Data.getBool(kPistols);
	plugin.Data.setBool(kPistols, false);
	if (wasOn) plugin.SendGlobalMessage("*** PISTOLS ONLY MODE IS OFF! ***\n" + player.FullName + " has spawned in");
}

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

Originally Posted by PapaCharlie9*:

 

ok got afew in our server and I see a slight issue, everytime someone spawns thats not in the admin list it keeps saying pistol mode off, was this intentional?

That was not intentional. I fixed it. Update by copying from post #7 again.

 

Yes, doing shotguns only is possible. You can do it yourself.

 

1) Find your BF3.def file in procon/Config (procon/Configs_)

 

2) Look in the BF3.def file for the list of weapons.

 

3) Copy just the names of weapons that are shotguns into a text file, like this:

 

870MCS

M1014

DAO-12

 

4) Make a copy of Step 2 limit code into a separate text file

 

5) Do a search and replace of "Pistol" for "Shotgun". It should look something like this when you are done:

 

Code:

/* VERSION 0.0.8/R1 */

String kShotguns = "Shotguns only toggle"; // plugin.Data bool
bool isShotgunsOnly = false;

... etc.
Make sure you change EVERY instance of "pistol" to "shotgun" regardless of case. For example, the message string "*** PISTOLS ONLY MODE IS ON! ***" needs to be changed to "*** SHOTGUNS ONLY MODE IS ON! ***". Be consistent. If the original word was "Pistol" and you change it to "Shotgun", every "Pistol" must become "Shotgun", not "SHOTGUN" or "shotgun".

 

6) Do the same thing for the Step 3 limit code. Also, find this line after you do the search/replace:

 

Code:

if (!isShotgunsOnly || !Regex.Match(kill.Weapon, @"(_:M1911|M9|Taurus|MP412REX|MP443|Glock)", RegexOptions.IgnoreCase).Success) return false;
Take the list of weapons you copied from BF3.def and replace the list in that line of code, separating each name by a vertical bar | character. It will look something like this:

 

Code:

if (!isShotgunsOnly || !Regex.Match(kill.Weapon, @"(_:870MCS|M1014|DAO-12|xxxx|yyyy|zzzz)", RegexOptions.IgnoreCase).Success) return false;
It should be obvious that you replace xxxx, yyyy, zzzz, etc. with whatever other weapon names you want.

 

7) For the Step 4 code in post #7, copy into a separate text file and search/replace "pistol" for "shotgun", just like for step 2 and 3.

 

8) Now create three new limits with your new copies of the code, OnAnyChat, OnKill and OnSpawn, and copy your revised code into each corresponding limit. Basically follow the same steps as in post #1, but with your revised code.

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

Originally Posted by Tomgun*:

 

like this?

 

/* VERSION 0.0.8/R1 */

 

String kShotguns = "Shotguns only toggle"; // plugin.Data bool

bool isShotgunsOnly = false;

 

String tag = player.Tag;

if (tag.Length == 0) {

// Maybe they are using [_-=]XXX[=-_]PlayerName format

Match tm = Regex.Match(player.Name, @"^[=_\-]_([^=_\-]{2,4})[=_\-]");

if (tm.Success) {

tag = tm.Groups[1].Value;

} else {

tag = "no tag";

}

}

 

if (!plugin.isInList(player.Name, "admins") && !plugin.isInList(tag, "admins")) return false;

 

Match m = Regex.Match(player.LastChat, @"^\s*!Shotguns_\s+(on|off)", RegexOptions.IgnoreCase);

 

if (!m.Success) return false;

 

String mode = m.Groups[1].Value;

 

if (mode == "on") {

isShotgunsOnly = true;

} else if (mode == "off") {

isShotgunsOnly = false;

}

 

if (isShotgunsOnly) {

plugin.SendGlobalMessage("*** SHOTGUNS ONLY MODE IS ON! ***");

plugin.ServerCommand("admin.yell", "SHOTGUNS ONLY STARTING NOW!");

} else {

plugin.SendGlobalMessage("*** SHOTGUNS ONLY MODE IS OFF! ***");

plugin.ServerCommand("admin.yell", "You can use any weapon now, no more Shotguns only");

}

 

plugin.Data.setBool(kShotguns, isShotgunsOnly);

 

return false;

and

 

/* VERSION 0.0.8/R1 */

 

if (killer.Name == victim.Name) return false; // don't punish Suicides

 

if (Regex.Match(kill.Weapon, @"(_:SoldierCollision,DamageArea,Suicide,RoadKill) ", RegexOptions.IgnoreCase).Success) return false; // don't punish weird death cases

 

String kShotguns = "Shotguns only toggle"; // plugin.Data bool

bool isShotgunsOnly = false;

 

if (plugin.Data.issetBool(kShotguns)) isShotgunsOnly = plugin.Data.getBool(kShotguns);

 

if (!isShotgunsOnly || !Regex.Match(kill.Weapon, @"(_:870MCS|M1014|DAO-12|jackhammer|M26Mass|Siaga20k|USAS-12|SPAS-12)", RegexOptions.IgnoreCase).Success) return false;

 

String kCounter = killer.Name + "_TreatAsOne_Count_Pistol";

TimeSpan time = TimeSpan.FromSeconds(1); // Activations within 1 seconds count as 1

 

int warnings = 0;

if (server.Data.issetInt(kCounter)) warnings = server.Data.getInt(kCounter);

 

/*

The first time through, warnings is zero. Whether this is an isolated

activation or the first of a sequence of activations in a short period

of time, do something on this first time through.

*/

String msg = "none";

if (warnings == 0) {

msg = "We are playing Shotguns only!";

plugin.ServerCommand("admin.say", "FINAL WARNING " + killer.Name + "! " + msg, "player", killer.Name);

plugin.ServerCommand("admin.yell", msg, "15", "player", killer.Name);

plugin.PRoConChat("ADMIN to " + killer.Name + "> " + msg);

plugin.KillPlayer(killer.Name, 5);

server.Data.setInt(kCounter, warnings+1);

return false;

}

 

/*

The second and subsequent times through, check to make sure we are not

getting multiple activations in a short period of time. Ignore if

less than the time span required.

*/

 

if (limit.Activations(killer.Name, time) > 1) return false;

 

/*

We get here only if there was exactly one activation in the time span

*/

 

if (warnings == 1) {

msg = "Shotguns only, next time you are banned!";

plugin.ServerCommand("admin.say", "FINAL WARNING " + killer.Name + "!" + msg, "player", killer.Name);

plugin.ServerCommand("admin.yell", msg, "10", "player", killer.Name);

plugin.PRoConChat("ADMIN to " + killer.Name + ">" + msg);

plugin.KickPlayerWithMessage(killer.Name, msg);

} else {

msg = "Temp banning " + killer.Name + " for not using a pistol";

plugin.SendGlobalMessage(msg);

plugin.ServerCommand("admin.yell", msg);

plugin.PRoConChat("ADMIN > " + msg);

plugin.PRoConEvent(msg, "Insane Limits");

plugin.EABanPlayerWithMessage(EABanType.Name, EABanDuration.Temporary, killer.Name, 10, msg);

}

server.Data.setInt(kCounter, warnings+1);

return false;

and

 

/* VERSION 0.8/R1 */

String kShotguns = "Shotguns only toggle"; // plugin.Data bool

 

String tag = player.Tag;

if (tag.Length == 0) {

// Maybe they are using [_-=]XXX[=-_]PlayerName format

Match tm = Regex.Match(player.Name, @"^[=_\-]_([^=_\-]{2,4})[=_\-]");

if (tm.Success) {

tag = tm.Groups[1].Value;

} else {

tag = "no tag";

}

}

 

if (!plugin.isInList(player.Name, "admins") && !plugin.isInList(tag, "admins")) {

bool wasOn = plugin.Data.issetBool(kShotguns);

if (wasOn) wasOn = plugin.Data.getBool(kShotguns);

plugin.Data.setBool(kShotguns, false);

if (wasOn) plugin.SendGlobalMessage("*** SHOTGUNS ONLY MODE IS OFF! ***\n" + player.FullName + " has spawned in");

}

 

return false;

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

Originally Posted by Tomgun*:

 

I think Im doing something wrong, I dont get any warnings atall.. everything is the same, im using custom admin list (its working because we can activate it) nothing on whitelist, but no warnings..

 

pharbehind, I dont think its in there as its scoped, why not just not use the scoped version..

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

Originally Posted by PapaCharlie9*:

 

like this?

I only skimmed your code, but everything I looked at seems right. Have you tried it?

 

EDIT: I see now you posted that it is not working. I looked more closely at the code and it all looks right to me. Do you have the right evaluations? OnAnyChat for the first one, OnKill for the second, and OnSpawn?

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

Originally Posted by PapaCharlie9*:

 

I got a warning for not using a pistol after killing someone with the .44 scoped. Is that missing from the list of allowed guns?

The Scoped .44 is missing from BF3.def, so PRoCon doesn't recognize it. I'd be curious to know what weapon code PRoCon received for that weapon.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Phil_K*:

 

The Scoped .44 is missing from BF3.def, so PRoCon doesn't recognize it. I'd be curious to know what weapon code PRoCon received for that weapon.

Do you mean the "Taurus .44"?

That handgun is in and Procon uses the weapon codes provided with the onKill events.

 

Remember weapon attachments like scopes and other stuff are not reported with the onKill event.

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

Originally Posted by Phil_K*:

 

afew of the pistols it doesnt recognize ive noticed :P

Can you imagine how helpful and full of information that statement is? :ohmy:

 

Now to be serious again, it would be a help if you provide the onKill log entries

showing the pistols you mean. But keep in mind a BF3 client shows names also related to

weapon attachments which you will not find in the onKill messages.

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

Originally Posted by PapaCharlie9*:

 

Do you mean the "Taurus .44"?

That handgun is in and Procon uses the weapon codes provided with the onKill events.

 

Remember weapon attachments like scopes and other stuff are not reported with the onKill event.

Phil, it looks like there are some combinations of weapon+attachment that are treated like a different weapon. For example, the .44 and the .44 scoped appear as two different weapons in Battlelog weapon stats:

 

Code:

Name:Taurus 44, Slug:44-magnum, Category:Handheld weapons, Code:pTaur, Kills:7, ShotsFired:59, ShotsHit:14, Accuracy:23.73, Headshots:2, TimeEquipped:00:05:15

    Name:Taurus 44 scoped, Slug:44-scoped, Category:Handheld weapons, Code:pTaurS, Kills:9, ShotsFired:90, ShotsHit:24, Accuracy:26.67, Headshots:2, TimeEquipped:00:12:22
I think you already know this, because of this comment in BF3.def:

 

Code:

// None .44 Scoped Handgun
I agree that what we need to see is the console.log with the player.onKill event that contains the weapon code when someone is killed with a .44 scoped or a MP443 suppressed or the GunMaster version of the MP443, etc. Maybe we can set up a test server with 2 players to figure that out?
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Phil_K*:

 

Hi.

 

Phil, it looks like there are some combinations of weapon+attachment that are treated like a different weapon. For example, the .44 and the .44 scoped appear as two different weapons in Battlelog weapon stats:

That's because battlelog visualizes what the game client shows to the user. But it's not what the server sends via rcon.

You quote of the battlelog stats showed what I have expected. It's a different kind of "weapon model" with some slightly changed characteristics, but the same weapon for the rcon.

 

I think you already know this, because of this comment in BF3.def:

Those first guesses are based of what could be seen ingame or could be found in press releases.

But it is not based on rcon data.

 

I agree that what we need to see is the console.log with the player.onKill event that contains the weapon code when someone is killed with a .44 scoped or a MP443 suppressed or the GunMaster version of the MP443, etc. Maybe we can set up a test server with 2 players to figure that out?

Well, I've checked some different sources and I'm sorry but I have to disappoint you.

In the games mechanics the weapon has the same damage name which is reported via rcon for all variants of

the taurus .44. It doesn't mater if has the scope attached and shown as .44 scoped or a silencer or a suppressor.

 

But you may try on a server.

 

Greets

Phil.

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

Originally Posted by PapaCharlie9*:

 

Well, I've checked some different sources and I'm sorry but I have to disappoint you.

In the games mechanics the weapon has the same damage name which is reported via rcon for all variants of

the taurus .44. It doesn't mater if has the scope attached and shown as .44 scoped or a silencer or a suppressor.

EDIT: Nevermind, there is a bug in my code, lol.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

Guys, please update to R2. I fixed a bug which caused the problem that pharbehind discovered. The Scoped .44 was a red herring. The actual problem was that ALL pistols would get a warning, and non-pistols would NOT. It was "don't use pistols" limit instead of a "only use pistols" limit, lol.

 

Tomgun, for your shotgun code, find this line:

 

Code:

if (!isShotgunsOnly || !Regex.Match(kill.Weapon, @"(_:870MCS|M1014|DAO-12|jackhammer|M26Mass|Siaga20k|USAS-12|SPAS-12)", RegexOptions.IgnoreCase).Success) return false;
and change it to this:

 

Code:

if (!isShotgunsOnly || Regex.Match(kill.Weapon, @"(_:870MCS|M1014|DAO-12|jackhammer|M26Mass|Siaga20k|USAS-12|SPAS-12)", RegexOptions.IgnoreCase).Success) return false;
That is, remove the ! in front of the Regex.
* Restored post. It could be that the author is no longer active.
Link to comment
  • 1 month later...

Originally Posted by Hutchew*:

 

Awesome, Papa..works as intended.......THANK YOU!

 

I have been trying to adjust it to allow mellee/knife/defib/repair tool kills, but I just keep breaking it ..........

 

Please help!

 

Also, if you ever need me to jump in the test server for experimentation, just give me a jab in battlelog.

 

Hutchew

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

Originally Posted by PapaCharlie9*:

 

Awesome, Papa..works as intended.......THANK YOU!

 

I have been trying to adjust it to allow mellee/knife/defib/repair tool kills, but I just keep breaking it ..........

 

Please help!

 

Also, if you ever need me to jump in the test server for experimentation, just give me a jab in battlelog.

 

Hutchew

Just find this line from post #1, Step 3:

 

Code:

if (!isPistolsOnly || Regex.Match(kill.Weapon, @"(_:M1911|M9|Taurus|MP412REX|MP443|Glock)", RegexOptions.IgnoreCase).Success) return false;
And change the weapon names to match the ones you want. Use BF3.def for the correct names. For example, for what you asked for make this change:

 

Code:

if (!isMeleeOnly || Regex.Match(kill.Weapon, @"(_:Melee|Knife|Defib|Repair)", RegexOptions.IgnoreCase).Success) return false;
Notice that "Knife" works for both "Weapons/Knife/Knife" and "Knife_RazorBlade" because the word "Knife" is in both of those names. As long as part matches, the whole thing matches, as in "Repair" for "Repair Tool".

 

Of course, you have to substitute each usage of "pistol" with "melee" in all the code as well (correct for case, so that isPistolsOnly becomes isMeleeOnly, not ismeleeonly), particularly for the commands in Step 2.

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

Originally Posted by Hutchew*:

 

Just find this line from post #1, Step 3:

 

Code:

if (!isPistolsOnly || Regex.Match(kill.Weapon, @"(_:M1911|M9|Taurus|MP412REX|MP443|Glock)", RegexOptions.IgnoreCase).Success) return false;
And change the weapon names to match the ones you want. Use BF3.def for the correct names. For example, for what you asked for make this change:

 

Code:

if (!isMeleeOnly || Regex.Match(kill.Weapon, @"(_:Melee|Knife|Defib|Repair)", RegexOptions.IgnoreCase).Success) return false;
So to allow melee/knife kills in addition to pistols only.......... would this be correct?

Code:

if (!isPistolsOnly || Regex.Match(kill.Weapon, @"(_:M1911|M9|Taurus|MP412REX|MP443|Glock|Melee|Knife|Defib|Repair)", RegexOptions.IgnoreCase).Success) return false;
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

So to allow melee/knife kills in addition to pistols only.......... would this be correct?

Code:

if (!isPistolsOnly || Regex.Match(kill.Weapon, @"(_:M1911|M9|Taurus|MP412REX|MP443|Glock|Melee|Knife|Defib|Repair)", RegexOptions.IgnoreCase).Success) return false;
Yup.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Cornholio*:

 

Hi,

 

I made a shotgun only mode as described on first page.

when I turn off the shotgun mode, and restart it after a couple of minutes,

is does not clear the warnings/non-shotgun kill counters....

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

Originally Posted by PapaCharlie9*:

 

Hi,

 

I made a shotgun only mode as described on first page.

when I turn off the shotgun mode, and restart it after a couple of minutes,

is does not clear the warnings/non-shotgun kill counters....

Yes, that's true. The code is rather simple and doesn't really handle turning on/off very well. The code would have to be much more complicated to reset all the counters from a previous session.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by HexaCanon*:

 

Yes, that's true. The code is rather simple and doesn't really handle turning on/off very well. The code would have to be much more complicated to reset all the counters from a previous session.

hm .. can't it be done like this for step 2

 

Code:

/* VERSION 0.0.8/R2 */

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);

String kCounter = player.Name + "_TreatAsOne_Count_Pistol";
int warnings = 0;
if (server.Data.issetInt(kCounter)) warnings = server.Data.getInt(kCounter);

String kPistols = "Pistols only toggle"; // plugin.Data bool
bool isPistolsOnly = false;

String tag = player.Tag;
if (tag.Length == 0) {
	// Maybe they are using [_-=]XXX[=-_]PlayerName format
	Match tm = Regex.Match(player.Name, @"^[=_\-]_([^=_\-]{2,4})[=_\-]");
	if (tm.Success) {
		tag = tm.Groups[1].Value;
	} else {
		tag = "no tag";
	}
}

if (!plugin.isInList(player.Name, "admins") && !plugin.isInList(tag, "admins")) return false;

Match m = Regex.Match(player.LastChat, @"^\s*!pistols_\s+(on|off)", RegexOptions.IgnoreCase);

if (!m.Success) return false;

String mode = m.Groups[1].Value;

if (mode == "on") {
	isPistolsOnly = true;
    foreach (PlayerInfoInterface p in all) {
        server.Data.setInt(kCounter, 0);
        warnings = server.Data.getInt(kCounter);
    }
} else if (mode == "off") {
	isPistolsOnly = false;
}

if (isPistolsOnly) {
	plugin.SendGlobalMessage("*** PISTOLS ONLY MODE IS ON! ***");
	plugin.ServerCommand("admin.yell", "PISTOLS ONLY STARTING NOW!");
} else {
	plugin.SendGlobalMessage("*** PISTOLS ONLY MODE IS OFF! ***");
	plugin.ServerCommand("admin.yell", "You can use any weapon now, no more pistols only");
}

plugin.Data.setBool(kPistols, isPistolsOnly);

return false;
i have not tested it, just made it fast.

 

or the foreach section should be like this

 

Code:

foreach (PlayerInfoInterface p in all) {
        kCounter = p.Name + "_TreatAsOne_Count_Pistol";
        server.Data.setInt(kCounter, 0);
        warnings = server.Data.getInt(kCounter);
    }
* 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.