ImportBot Posted November 13, 2012 Share Posted November 13, 2012 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
ImportBot Posted November 13, 2012 Author Share Posted November 13, 2012 Originally Posted by pharbehind*: You're the man. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted November 13, 2012 Author Share Posted November 13, 2012 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
ImportBot Posted November 14, 2012 Author Share Posted November 14, 2012 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
ImportBot Posted November 14, 2012 Author Share Posted November 14, 2012 Originally Posted by PapaCharlie9*: I finally got a check to compile everything. I fixed the remaining mistakes in Step 3. The OP is good to go now. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted November 14, 2012 Author Share Posted November 14, 2012 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
ImportBot Posted November 14, 2012 Author Share Posted November 14, 2012 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
ImportBot Posted November 14, 2012 Author Share Posted November 14, 2012 Originally Posted by Tomgun*: nice work cheers now what If I wanted to also add a shotguns only option same setup, is that possible? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted November 14, 2012 Author Share Posted November 14, 2012 Originally Posted by Tomgun*: 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? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted November 14, 2012 Author Share Posted November 14, 2012 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
ImportBot Posted November 15, 2012 Author Share Posted November 15, 2012 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
ImportBot Posted November 18, 2012 Author Share Posted November 18, 2012 Originally Posted by pharbehind*: 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? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted November 19, 2012 Author Share Posted November 19, 2012 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
ImportBot Posted November 20, 2012 Author Share Posted November 20, 2012 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
ImportBot Posted November 20, 2012 Author Share Posted November 20, 2012 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
ImportBot Posted November 20, 2012 Author Share Posted November 20, 2012 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
ImportBot Posted November 20, 2012 Author Share Posted November 20, 2012 Originally Posted by Tomgun*: afew of the pistols it doesnt recognize ive noticed * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted November 20, 2012 Author Share Posted November 20, 2012 Originally Posted by Phil_K*: afew of the pistols it doesnt recognize ive noticed Can you imagine how helpful and full of information that statement is? 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
ImportBot Posted November 20, 2012 Author Share Posted November 20, 2012 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:22I think you already know this, because of this comment in BF3.def: Code: // None .44 Scoped HandgunI 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
ImportBot Posted November 21, 2012 Author Share Posted November 21, 2012 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
ImportBot Posted November 22, 2012 Author Share Posted November 22, 2012 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
ImportBot Posted November 22, 2012 Author Share Posted November 22, 2012 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
ImportBot Posted January 5, 2013 Author Share Posted January 5, 2013 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
ImportBot Posted January 5, 2013 Author Share Posted January 5, 2013 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
ImportBot Posted January 6, 2013 Author Share Posted January 6, 2013 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
ImportBot Posted January 6, 2013 Author Share Posted January 6, 2013 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
ImportBot Posted January 11, 2013 Author Share Posted January 11, 2013 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
ImportBot Posted January 12, 2013 Author Share Posted January 12, 2013 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
ImportBot Posted January 14, 2013 Author Share Posted January 14, 2013 Originally Posted by Cornholio*: hmm that sucks now I have to restart te plugin each time I would like to turn on shotgun mode If you have any time left, can you plze update the code ? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 14, 2013 Author Share Posted January 14, 2013 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
Recommended Posts
Archived
This topic is now archived and is closed to further replies.