ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by Bl1ndy*: Does Team First Blood work with SQDM? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by droopie*: just a auto messages question, can someone write an example to use like the spambot but for each message to send it 3 times in a row? 15minutes SEND THIS MESSAGE SEND THIS MESSAGE SEND THIS MESSAGE 15minutes SEND THIS OTHER MESSAGE SEND THIS OTHER MESSAGE SEND THIS OTHER MESSAGE etc... for bf2 it had like that but every message line had a timer on it. to send 1 instantly it was like 300 message 0 line 2 0 line 3 300 other message 0 other line 2 0 other line 3 etc... the 0 was a 0 second value so wish it had that to make sure people would read the messages if displayed like that. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by WaxMyCarrot*: Yes Does Team First Blood work with SQDM? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by QUACK-Major-Pain*: Hi. As some cheaters have reached their ranks spending playing only for a short time i'm thinking about if a limit setting time spend playing and rank into some relation might be a good idea for preventing them to enter the server? Greets Phil. I think something like (players overall time / rank) Using my own stats as an example where I have 161 hrs and rank 58. Hackers can be found to be rank 36 in 24 hrs as an example. The question would be, what is an acceptable number? 4, 4.5, 5, 5.5? Looking through our clan members, our lowest is 1.62, so I guess I would be comfortable with about 1.5. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by PapaCharlie9*: just a auto messages question, can someone write an example to use like the spambot but for each message to send it 3 times in a row?This is going to be easy to do in version 0.0.0.8, so just hang on for that version. It can be done in 0.7, but it's a lot of code to write, which would then become of no use when 0.8 comes out. If someone really wants to do it, the basic recipe (algorithm) I would use requires 2 separate limits: Limit A - OnSpawn * first_check: Is the interval set in server.RoundData? Activate only if it is not set. * second_check: * Set an interval value in server.RoundData (900 seconds is 15 minutes) * Set the current time in seconds in another RoundData value. * The automatic clearing of RoundData insures that this gets reset at the beginning of every round and triggering OnSpawn only spams if there is a player in the game to spam at. Limit B - OnInterval * first_check: Is the interval set in server.RoundData? * second_check: * Calculate the amount of elapsed time and compare to the interval. * If elapsed time is greater than the interval value: ** Execute action: in the requested case, do admin.say of the same message three times. ** Update the stored time with the current time * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by PapaCharlie9*: Think he means total hours played vs rank.Since Rank is based on score, SPM is highly correlated. It's not exactly the same, since there may be some points not included in SPM, like awards/ribbons/medals, that do count to rank, but in general I think you can just use SPM. That said, I do look at total time when considering the overall picture of a hacker. Anyone who's number #1 kills is a second level Assignment unlock, like L96, after less than 2 hours of play is probably hacking. I suppose it's possible to do with a cooperating friend and some booster servers, but that's damning in itself. It's definitely hacking if the weapon is the Jackhammer (requires 6 hours minimum). * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by TMiland*: This limit will wait until there are less than 20 tickets remaining in either team. It will announce three times the name of the top scoring clan. Set limit to evaluate OnSpawn, set action to None Set first_check to this Expression: Code: (team1.RemainTicketsPercent < 20 || team2.RemainTicketsPercent < 20)Set second_check to this Code: Code: double count = limit.Activations(); if (count > 3) return false; List<PlayerInfoInterface> players = new List<PlayerInfoInterface>(); players.AddRange(team1.players); players.AddRange(team2.players); Dictionary<String, double> clan_stats = new Dictionary<String, double>(); /* Collect clan statistics */ foreach(PlayerInfoInterface player_info in players) { if(player_info.Tag.Length == 0) continue; if (!clan_stats.ContainsKey(player_info.Tag)) clan_stats.Add(player_info.Tag, 0); clan_stats[player_info.Tag] += player_info.ScoreRound; } /* Find the best scoring clan */ String best_clan = String.Empty; double best_score = 0; foreach(KeyValuePair<String, double> pair in clan_stats) if (pair.Value > best_score) { best_clan = pair.Key; best_score = pair.Value; } if (best_clan.Length > 0) { String message = "Top scoring clan this round is "+ best_clan + " with " + best_score + " points!"; plugin.SendGlobalMessage(message); plugin.ConsoleWrite(message); } return false;This limit should work for TDM, CQ, and Rush. It will not work properly for SQDM because it assumes there are only two teams.Hi, We don't use the tag function, we have it in the name...is it possible to get the clan tag from the playername? If you can define specific letters to look for, for example we use NBF-PlayerName... Any advice is welcome. Regards. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by Phil_K*: Hi. Time spent leveling between ranks, is that what you mean? Is this info available in Battlelog?It would be nice if that info would be accessible because i think you could get a feeling for it which rank steps had a helping hand. But more i had in mind ... Think he means total hours played vs rank.this. For example take a look at this stats i came across in another forum: http://battlelog.battlefield.com/bf3...ats/394892442/ Its rank 52 in less than 7 hours. For me that is not done with legit play style. And i have seen a lot more stats were ranks above 30 have been reached with a total time played that also doesn't fit to people with much spare time and continuous play with normal methods. Btw, thanks PhaxeNor for the example. I think something like (players overall time / rank) At first i had something in mind like that, a quotient representing rank per time or time per rank.But having an experienced player starting from new will break this right from the start if it is not combined with a limit on time and rank to start the checks on i guess. Therefor I'm more with what PhaxeNor posted. The reason i posted this though was to get a feeling how other see those fast-leveling-profiles and to get a feeling for the limits suitable. Thanks Phil. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by ganjaparadise*: Hey guys, I search a solution to prevent my server to statpad with suicide, this morning a player suicide himself and got 30k point... It's possible to count a number of suicide and kick him ? Thank You. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by TMiland*: Hey guys, I search a solution to prevent my server to statpad with suicide, this morning a player suicide himself and got 30k point... It's possible to count a number of suicide and kick him ? Thank You. Hi, how is that even possible? You don't get points for suicide? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by ganjaparadise*: I don't know cos i can't go to my server... I just can watch log and layer, but when a player 've 0 kills 40 deaths and only suicide appear on log with 30k point i suppose it's a statpadd... * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by Phil_K*: Hi. I would guess he is playing on a conquest map, takes all flags for one side, kills himself switching to the other team and recaptures the flags. Some repeat this over and over and yes, it is statspadding. But you should find a battle report of that round in battlelog. Greets Phil. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by ganjaparadise*: I find the round ! http://battlelog.battlefield.com/bf3...9/1/367617655/ It's possible to prevent that to kick him when he obtain 10-15 suicides or less ? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by ghostfighter777*: hi, anyone can help me please ? :s report : System.ArgumentOutOfRangeException: L'index était hors limites. Il ne doit pas être négatif et doit être inférieur à la taille de la collection. Nom du paramètre*: index Stack Trace: Ã System.ThrowHelper.ThrowArgumentOutOfRangeExceptio n() Ã System.Collections.Generic.List`1.get_Item(Int32 index) Ã PRoConEvents.ServerInfo.get_MapFileName() Ã PRoConEvents.InsaneLimits.LimitEvent..ctor(Limit limit, PlayerInfoInterface player, ServerInfoInterface server) Ã PRoConEvents.InsaneLimits.Limit.RecordEvaluation(P layerInfoInterface player) Ã PRoConEvents.InsaneLimits.evaluateLimitChecks(Limi t limit, PlayerInfoInterface player, PlayerInfoInterface killer, PlayerInfoInterface victim, KillInfoInterface kill) Ã PRoConEvents.InsaneLimits.executeLimitAction(Limit limit, PlayerInfoInterface player, PlayerInfoInterface killer, PlayerInfoInterface victim, KillInfoInterface kill) Ã PRoConEvents.InsaneLimits.evaluateLimit(Limit limit, PlayerInfo player) Ã PRoConEvents.InsaneLimits.enforcer_thread_loop() MSIL Stack Trace: Void ThrowArgumentOutOfRangeException(), IL: 0x0 T get_Item(Int32), IL: 0x9 System.String get_MapFileName(), IL: 0x19 Void .ctor(Limit, PRoConEvents.PlayerInfoInterface, PRoConEvents.ServerInfoInterface), IL: 0x3C Void RecordEvaluation(PRoConEvents.PlayerInfoInterface) , IL: 0x5C Boolean evaluateLimitChecks(Limit, PRoConEvents.PlayerInfoInterface, PRoConEvents.PlayerInfoInterface, PRoConEvents.PlayerInfoInterface, PRoConEvents.KillInfoInterface), IL: 0x134 Boolean executeLimitAction(Limit, PRoConEvents.PlayerInfoInterface, PRoConEvents.PlayerInfoInterface, PRoConEvents.PlayerInfoInterface, PRoConEvents.KillInfoInterface), IL: 0x33 Boolean evaluateLimit(Limit, PRoConEvents.PlayerInfo), IL: 0x0 Void enforcer_thread_loop(), IL: 0x289 code :Code: Dictionary<String, String> liste_map_rotation = new Dictionary<String, String>(); //liste des maps en rotation liste_map_rotation.Add("MP_007", "MP_012"); liste_map_rotation.Add("MP_012", "MP_Subway"); liste_map_rotation.Add("MP_Subway", "MP_011"); liste_map_rotation.Add("MP_011", "MP_007"); if (liste_map_rotation.ContainsKey(server.MapFileName)) { plugin.ServerCommand("mapList.clear"); if (server.PlayerCount < 10 ) { plugin.ServerCommand("mapList.add "+liste_map_rotation[server.MapFileName]+" ConquestSmall0 2"); plugin.SendGlobalMessage("The next map is " + liste_map_rotation[server.MapFileName]+" on Conquest large"); } else { plugin.ServerCommand("mapList.add "+liste_map_rotation[server.MapFileName]+" ConquestLarge0 2"); plugin.SendGlobalMessage("The next map is " + liste_map_rotation[server.MapFileName]+" on Conquest"); } plugin.ServerCommand("mapList.save"); } else { plugin.ServerCommand("mapList.clear"); if (server.PlayerCount < 10 ) { plugin.ServerCommand("mapList.add MP_007 ConquestSmall0 2 0"); } else { plugin.ServerCommand("mapList.add MP_007 ConquestLarge0 2 0"); } plugin.ServerCommand("mapList.save"); } return false; * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by Phil_K*: I find the round ! http://battlelog.battlefield.com/bf3...9/1/367617655/ It's possible to prevent that to kick him when he obtain 10-15 suicides or less ? Looking at the report it doesn't look like the classic flag taking stats padding as mostly players do that alone or as a duo. Afaik his objective score would than be higher. In that match the score was mostly done with vehicles and by awards. Hmm.. suicide has its own death strings and it should be possible to count them in relation to a given time or points achieved. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by Bl1ndy*: Where can i find the weapon codes for sniper rifles? I'm trying to make a sniper only server. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 17, 2012 Author Share Posted January 17, 2012 Originally Posted by PapaCharlie9*: For example take a look at this stats i came across in another forum: http://battlelog.battlefield.com/bf3...ats/394892442/ player.Spm > 1000 would catch that guy. Heck, player.Spm > 2000 would catch that guy. His SPM is 8840! Where can i find the weapon codes for sniper rifles? I'm trying to make a sniper only server.Look in your PRoCon installation folders and find a file called BF3.def (usually in procon/Configs). That is a text file that lists all the names for (almost) all of the weapons. Look for "SniperRifle". Each line contains the name of a sniper rifle. For example: Code: procon.protected.weapons.add Recon "M40A5" Primary SniperRifleM40A5 is the name of a sniper rifle. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 18, 2012 Author Share Posted January 18, 2012 Originally Posted by PapaCharlie9*: This example uses two limits, one to announce admin's when they join, the other to provide an in-game command that allows players to ask for a list of admins with !adminlist. Requires 0.0.0.7 or later. Note: These examples compiled successfully, but I didn't try them to see if they worked. Preparation Set use_custom_lists to True and create a new list with these parameters: Code: name = admins data = name1, name2, name3, ... Note: The names in the list must be spelled exactly as the soldier name of the player, without a tag. If the name is some crazy l337| Admin Announcer Limit Create a new limit to evaluate OnJoin and set action to Say Set first_check to this Expression: Code: ( plugin.isInList(player.Name, "admins") )Leave second_check Disabled. Set these action specific parameters: Code: say_message: Admin %p_fn% has just joined! say_audience: All say_delay: 60There's a minimum of about a minute between the join and spawn, depending on how much load-out and squad changing the player does, so wait 60 seconds before issuing the say so that they can see the greeting too. In-Game Admin List Command Create a new limit to evaluate OnAnyChat and set action to None Set first_check to this Expression: Code: ( plugin.IsInGameCommand(player.LastChat) )Set second_check to this Code: Code: /* Extract the command */ String command = plugin.ExtractInGameCommand(player.LastChat); /* Sanity check the command */ if (null == command || command.Length == 0) return false; /* Parse the command */ if (Regex.Match(command, "adminlist", RegexOptions.IgnoreCase).Success) { String adminList = "Admins: "; bool found = false; List<PlayerInfoInterface> players = new List<PlayerInfoInterface>(); players.AddRange(team1.players); players.AddRange(team2.players); if (team3.players.Count > 0) players.AddRange(team3.players); if (team4.players.Count > 0) players.AddRange(team4.players); foreach (PlayerInfoInterface p in players) { if (plugin.isInList(p.Name, "admins")) { if (found) adminList = adminList + ", " + p.Name; else adminList = adminList + p.Name; found = true; } } if (found) plugin.SendSquadMessage(player.TeamId, player.SquadId, adminList); } return false;For the example list of admins given above, the chat output will look like this: Admins: name1, name2, name3 * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 18, 2012 Author Share Posted January 18, 2012 Originally Posted by TMiland*: Anyone? myrcon.net/...insane-limits-examples#entry18650 * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 18, 2012 Author Share Posted January 18, 2012 Originally Posted by HexaCanon*: i do not know if this was mentioned before, but i found out that most hackers that come on my server start the killing at the first 2 minutes of the round and then they stop using the hack. i just started using this limit against them OnKill first check : expression Code: ( server.TimeRound < 60 && player.KillsRound > 10 )second check : disabled action : what ever you want (kick/ban/etc..) this limit will be triggered when a player gets more than 10 kills in the first minute of the round. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 18, 2012 Author Share Posted January 18, 2012 Originally Posted by HopHead*: Hi. As some cheaters have reached their ranks spending playing only for a short time i'm thinking about if a limit setting time spend playing and rank into some relation might be a good idea for preventing them to enter the server? Greets Phil. Why not just look at SCORE / MIN ? Code: player.Spm > 1000 * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 18, 2012 Author Share Posted January 18, 2012 Originally Posted by BobyTT*: I got this error: [23:16:06 93] [insane Limits] Compiling Limit #1 - K/Dr10 SPM900 - OnJoin [23:16:07 17] [insane Limits] ERROR: 2 errors compiling Expression [23:16:07 17] [insane Limits] ERROR: (CS0117, line: 20, column: 51): 'PRoConEvents.PlayerInfoInterface' does not contain a definition for 'kills' [23:16:07 17] [insane Limits] ERROR: (CS0117, line: 20, column: 118): 'PRoConEvents.PlayerInfoInterface' does not contain a definition for 'kills' Any idea why? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 18, 2012 Author Share Posted January 18, 2012 Originally Posted by Froz3nTundra*: micovery, the "Welcome Message Based on Country " limit looks great, any other countries to add? Sorry, wrong place, feel free to move this. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 18, 2012 Author Share Posted January 18, 2012 Originally Posted by tarreltje*: I was looking into the announce top scoring clan for my SQDM server, so that it shows near end round which team is winning, but this isnt able to do, or is it fixed already? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 18, 2012 Author Share Posted January 18, 2012 Originally Posted by Froz3nTundra*: Rule #47 not working, double checked settings all seem correct, ideas? Some of these limits just not working as they should, is 0.0.0.7 buggy? A lot of the time, when procon starts up, none of the limits are compiled, they are enabled but show as not compiled... * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 18, 2012 Author Share Posted January 18, 2012 Originally Posted by Rucki*: micovery, the "Welcome Message Based on Country " limit looks great, any other countries to add? Sorry, wrong place, feel free to move this. Code: double count = limit.ActivationsTotal(player.Name); if (count > 1) return false; String CC = player.CountryCode; if (CC.Equals("us")) plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("Welcome on Zockerstrich %p_n%!")); else if (CC.Equals("at")) plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("Servus %p_n% am Zockerstrich!")); else if(CC.Equals("fr")) plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("Bienvenue a Zockerstrich %p_n%!")); else if(CC.Equals("se")) plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("Vaelkommen till Zockerstrich %p_n%!")); else if(CC.Equals("fi")) plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("Tervetuloa Zockerstrich %p_n%!")); else if (CC.Equals("it")) plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("Benvenuto al Zockerstrich %p_n% !")); else if (CC.Equals("de")) plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("Willkommen am Zockerstrich %p_n%!")); else if (CC.Equals("be")) plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("Willkommen/Bienvenue/Welkom am Zockerstrich %p_n%!")); else if (CC.Equals("ch")) plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("Grueezi am Zockerstrich %p_n%!")); else if (CC.Equals("cz")) plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("Vítejte na Zockerstrich %p_n%!")); else if (CC.Equals("pl")) plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("Zapraszamy do Zockerstrich %p_n%!")); else if (CC.Equals("no")) plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("Velkommen til Zockerstrich %p_n%!")); else if (CC.Equals("nl")) plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("Welkom bij de Zockerstrich%p_n%!")); else if (CC.Equals("hu")) plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("Uedvoezoeljuek a Zockerstrich %p_n%!")); else plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("Welcome on Zockerstrich %p_n% from %p_cn%!")); return false;In this example you can find an entrys with: Code: else if (CC.Equals("xx")) plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("your language %p_n% say hello!"));Also you can paste this two lines for a new country.Coutrycodes you can find here: http://www.uspto.gov/patft/help/helpctry.htm Rucki If some of my messages are wrong translated; its a mistake from google-translator. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 19, 2012 Author Share Posted January 19, 2012 Originally Posted by PapaCharlie9*: Anyone? myrcon.net/...insane-limits-examples#entry18650 is it possible to get the clan tag from the playername? If you can define specific letters to look for, for example we use NBF-PlayerName... It depends on the pattern. If it is always NBF, you don't need code to extract that, you always know it's NBF, right? All you really need is a way to detect if a player name starts with "NBF-". Here's how: Code: if (Regex.Match(player.Name, @"^NBF-").Success) { String tag = "NBF"; // ... your code follows this comment }If you want to ignore the case of the tag, i.e., allow nbf as well as NBF, you make one small change: Code: if (Regex.Match(player.Name, @"^NBF-", [b]RegexOptions.IgnoreCase[/b]).Success) { String tag = "NBF"; // ... your code follows this comment }If you want instead to extract any tag that follows the pattern: XXX-PlayerName Where XXX can be NBF, or nbf, or ABC or 123 or MM (only two letters) or FCKU (four letters), that is, the requirements are: * First 2 to 4 characters in the name followed by one - (minus sign), no spaces separating * Everything after the - (minus sign) is the player name You can use something like this (not tested): Code: Match myMatch = Regex.Match(player.Name, @"^([^\s]{2,4})-([^\s]+)"); if (myMatch.Success) { String tag = myMatch.Groups[1].Value; String playerName = myMatch.Groups[2].Value; }Breaking down the regular expression (regex) step by step (this is not code, but rather a formatted explanation of what all the codes mean in the regular expression): Code: ^ means, start matching from the beginning of player.Name ( means, start remembering everything that matches [ means, start a range of characters to match ^\s means, the range of characters that do NOT {^} include whitespace {\s}, such as spaces and tabs ] means, end of the range of characters to match {2,4} means, match at least 2 characters, but no more than 4 ) means, stop remembering everything that matches, this is Groups[1] - means, match one minus sign character literally ( means, start remembering everything that matches [ means, start a range of characters to match ^\s means, the range of characters that do NOT {^} include whitespace {\s}, such as spaces and tabs ] means, end of the range of characters to match + means, match one or more characters in the range ) means, stop remembering everything that matches, this is Groups[2] * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 19, 2012 Author Share Posted January 19, 2012 Originally Posted by kayjay*: When creating a limit that bans people, is it somehow possible to remove the "the ban duration is permanent" which is automatically added at the end? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 19, 2012 Author Share Posted January 19, 2012 Originally Posted by TMiland*: It depends on the pattern. If it is always NBF, you don't need code to extract that, you always know it's NBF, right? All you really need is a way to detect if a player name starts with "NBF-". Here's how: Code: if (Regex.Match(player.Name, @"^NBF-").Success) { String tag = "NBF"; // ... your code follows this comment }If you want to ignore the case of the tag, i.e., allow nbf as well as NBF, you make one small change: Code: if (Regex.Match(player.Name, @"^NBF-", [b]RegexOptions.IgnoreCase[/b]).Success) { String tag = "NBF"; // ... your code follows this comment }If you want instead to extract any tag that follows the pattern: XXX-PlayerName Where XXX can be NBF, or nbf, or ABC or 123 or MM (only two letters) or FCKU (four letters), that is, the requirements are: * First 2 to 4 characters in the name followed by one - (minus sign), no spaces separating * Everything after the - (minus sign) is the player name You can use something like this (not tested): Code: Match myMatch = Regex.Match(player.Name, @"^([^\s]{2,4})-([^\s]+)"); if (myMatch.Success) { String tag = myMatch.Groups[1].Value; String playerName = myMatch.Groups[2].Value; }Breaking down the regular expression (regex) step by step (this is not code, but rather a formatted explanation of what all the codes mean in the regular expression): Code: ^ means, start matching from the beginning of player.Name ( means, start remembering everything that matches [ means, start a range of characters to match ^\s means, the range of characters that do NOT {^} include whitespace {\s}, such as spaces and tabs ] means, end of the range of characters to match {2,4} means, match at least 2 characters, but no more than 4 ) means, stop remembering everything that matches, this is Groups[1] - means, match one minus sign character literally ( means, start remembering everything that matches [ means, start a range of characters to match ^\s means, the range of characters that do NOT {^} include whitespace {\s}, such as spaces and tabs ] means, end of the range of characters to match + means, match one or more characters in the range ) means, stop remembering everything that matches, this is Groups[2] Hi PapaCharlie9, thank you for taking your time, how would you implement this in the "announce top scoring clan limit"? Code: double count = limit.Activations(); if (count > 3) return false; List<PlayerInfoInterface> players = new List<PlayerInfoInterface>(); players.AddRange(team1.players); players.AddRange(team2.players); Dictionary<String, double> clan_stats = new Dictionary<String, double>(); /* Collect clan statistics */ foreach(PlayerInfoInterface player_info in players) { if(player_info.Tag.Length == 0) continue; if (!clan_stats.ContainsKey(player_info.Tag)) clan_stats.Add(player_info.Tag, 0); clan_stats[player_info.Tag] += player_info.ScoreRound; } /* Find the best scoring clan */ String best_clan = String.Empty; double best_score = 0; foreach(KeyValuePair<String, double> pair in clan_stats) if (pair.Value > best_score) { best_clan = pair.Key; best_score = pair.Value; } if (best_clan.Length > 0) { String message = "Top scoring clan this round is "+ best_clan + " with " + best_score + " points!"; plugin.SendGlobalMessage(message); plugin.ConsoleWrite(message); } return false;I am no coder, i understand the logic, but I'll just break the code... * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted January 19, 2012 Author Share Posted January 19, 2012 Originally Posted by Mootart*: Regex.Match(kill.Weapon, @"m320|smaw|rpg|usas-12|roadkill|death", RegexOptions.IgnoreCase).Success && server.MapFileName.StartsWith("MP_Subway") This code is for lock weapons activated only on map metro. how about a msg. to all will only appear when its on metro to can you help me with that code please. like: msg forbiden weapons. Bla bla bla this msg will only appear on map metro... is that possible? hope you could help me micovery.. will send soon this week.. for more beers.. * 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.