Jump to content

Insane Limits - Examples


ImportBot

Recommended Posts

Originally Posted by Singh400*:

 

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

 

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

The limit works fine, and that player has a SPM of 1571. His all-time SPM is 725.

 

You need to read ...*.

* Restored post. It could be that the author is no longer active.
Link to comment
  • Replies 1.4k
  • Created
  • Last Reply

Originally Posted by Mandizzy*:

 

The limit works fine, and that player has a SPM of 1571. His all-time SPM is 725.

 

You need to read ...*.

Thanks Singh. BTW, how did you come up with 1571? Which numbers are you looking at?
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by VuSniper*:

 

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

 

Set limit to evaluate OnInterval, and set action to None

 

Set first_check to use this Code snippet:

 

Code:

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

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

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

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

 

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

 

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

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

 

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

Is there a way of setting difference between Conquest small and large on this?

 

=Vu= Sniper

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

Originally Posted by VuSniper*:

 

This limit will check for how many times a player made non-pistol kills. On the first kill, it will send a warning on chat, on the second kill, it will kick the player.

 

 

Set limit to evaluate OnKill, set action to None

 

 

Set first_check to this Expression:

 

Code:

! Regex.Match(kill.Weapon, @"(M1911|M9|M93R|Taurus|MP412REX|MP443|Glock)", RegexOptions.IgnoreCase).Success
Set second_check to this Code:

 

Code:

double count = limit.Activations(player.Name);

     if (count == 1)
         plugin.SendGlobalMessage(plugin.R("%p_n%, this is a pistol only server, do not use %w_n% again! Next time kick"));
     else if (count > 1)
         plugin.KickPlayerWithMessage(player.Name, plugin.R("%p_n%, kicked you for using %w_n% on pistol only server"));
     
     return false;
You can use this limit as a template for restricting any weapon you want. Just change the Expression in the first_check depending on what weapon you want to restrict. The way it is right now, it will activate for any Non-Pistol ... that is because of the Negation symbol "!" at the begining of the expression. If you remove, the Negation symbol "!", it becomes a positive check. So you could make it activate for certain weapons, and restrict those only, while allowing the rest.
I used this to limit Sniper-rifles. Working fine on most of them, but had an issue with M39 EMR and M98B. I discovered that Procon

displays "M39 Sniper Rifle" in chat, and game on-screen display "M39 EMR". NONE of them worked in limiter, but "M39" worked...

The M98B displays "Barrett M98B Sniper Rifle" (Procon-chat) and M98B (Game on-screen). I have tryed the following in limiter: M98, M98B, M98B Sniper Rifle and Barrett M98B Sniper Rifle without success.

Any idea what to use?

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

Originally Posted by WrathsWrath*:

 

I figured out how to put in the codes and expressions...good job btw. But now it keeps dumping my files. Everytime I come back into procon I have no insane limits...I have to accept the agreement and then start configuring all over...is this due to the location of the procon folder perhaps? I have it on my desktop.

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

Originally Posted by Singh400*:

 

NOTE: You must use a modified version of Insane Limits to use this limit. Get it ...*.

 

Set limit to evaluate OnJoin, set action to None.

 

Set first_check to this Code:

Code:

double avg_per = 10 ;
double p_ka = ( ( player.killAssists / player.Kills ) * 100 ) ; 

if ( p_ka < avg_per )
	{	
		plugin.Log("Logs/InsaneLimits_KAP.csv", plugin.R("%date%,%time%,%p_n%,%l_n%,%p_pg%," + p_ka + ""));
		
	}

return false;
What this limit does is look at a incoming players kill assists vs total kills. The average is around 10% for all players. There might be some variance anywhere between 8%-12%. The reason for this limit is that most cheaters will have an extremely low number of kill assists usually somewhere in the 0%-5% range when compared to their total kills.

 

Hence it's a good limit for Server Admins to use. At the moment it's only a logging limit (what I call a passive limit), I'd be hesitant to use it as active limit (ie kick/ban based on the outcome of the limit). Perhaps it can be refined further.

I'm using a slightly revised code. It has a better success rate at detecting potential cheaters:-

Code:

double avg_per = 5 ;

double p_ka = ( ( player.KillAssists / player.Kills ) * 100 ) ; 

if ( ( p_ka <= avg_per ) && ( player.Kills >= 1000 ) )
	{	
		plugin.Log("Logs/InsaneLimits_PKA2.csv", plugin.R("%date%,%time%,%p_n%,%l_n%,%p_pg%," + p_ka + "")) ;
	}

return false ;
With this I'm getting a 90-95% success rate for cheater detection. So you have to manually review each player profile before you issue a ban or anything like that.
* Restored post. It could be that the author is no longer active.
Link to comment
  • 4 weeks later...

Originally Posted by MDV666*:

 

I'm using a slightly revised code. It has a better success rate at detecting potential cheaters:-

Code:

double avg_per = 5 ;

double p_ka = ( ( player.KillAssists / player.Kills ) * 100 ) ; 

if ( ( p_ka <= avg_per ) && ( player.Kills >= 1000 ) )
	{	
		plugin.Log("Logs/InsaneLimits_PKA2.csv", plugin.R("%date%,%time%,%p_n%,%l_n%,%p_pg%," + p_ka + "")) ;
	}

return false ;
With this I'm getting a 90-95% success rate for cheater detection. So you have to manually review each player profile before you issue a ban or anything like that.
what do it to kick this players? and how to be with players who only started to play for the sniper? they have a percent of wounds always the small
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Xeffox*:

 

This limit will send a a Good Morning message to all players, between 7AM, and 8 AM ... after the first kill each round. The reason I did it, for OnKill is so that it guarantees that everyone has already loaded the map, and will see the message.

 

Set limit to evaluate OnKill, set action to Say

 

Set first_check to this Expression:

 

Code:

DateTime.Now.TimeOfDay.CompareTo(TimeSpan.FromHours(7)) > 0 && DateTime.Now.TimeOfDay.CompareTo(TimeSpan.FromHours(8)) < 0
Set second_check to this Expression:

 

Code:

limit.Activations() == 1
Set these action specific parameters:

 

Code:

say_audience = All
        say_message = Good morning everyone, the time is %time%!
This example depends, on the Time-Zone of the computer (layer) where the plugin is running. If that turns to be a problem, you should adjust the 7 AM, and 8 AM values to account for Time-Zones.

 

Also, the hours should be put in military time. 1 PM = 13, 2 PM = 14, etc ...

It is possible to add minutes? 5:36, 15:45, etc.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Itz_cujo666*:

 

Hi, I've just started using Insane Limits, and it's really great, very flexible. I'm finding it easy enough to understand and implement for things such as KDr, KPM and SPM monitors and some of the other examples here, but I have a problem with 2 of them I can't get working....

 

For some reason the timing of the Server First Blood and Announce Top Scoring Clan examples are incorrect when I try and implement them. Server First Blood is being announced at the very end of each round, and Announce Top Scoring Clan is being announced at the beginning of the round (meant to be at end)!

 

What am I doing incorrectly...any advice/help?

 

Thanks!

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

Originally Posted by HexaCanon*:

 

Hi, I've just started using Insane Limits, and it's really great, very flexible. I'm finding it easy enough to understand and implement for things such as KDr, KPM and SPM monitors and some of the other examples here, but I have a problem with 2 of them I can't get working....

 

For some reason the timing of the Server First Blood and Announce Top Scoring Clan examples are incorrect when I try and implement them. Server First Blood is being announced at the very end of each round, and Announce Top Scoring Clan is being announced at the beginning of the round (meant to be at end)!

 

What am I doing incorrectly...any advice/help?

 

Thanks!

you need to add few checks such as amount of tickets or round time.

 

if you give me the actual limit i can fix it for you.

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

Originally Posted by Itz_cujo666*:

 

Thanks very much, really appreciate it, I've cut past them below (sorry they aren't as neat, with bold and hyperlinks and all, but I'm new.. :smile::

 

While trying to get them to work, I found my game server provided has me running 0.0.0.6 of Insane Limits, seems most recent is 0.8, maybe that has impact?

 

from here, it seems to work, but fires at the end of each round.... *

 

So, did what the instructions for the example said and set evaluation on kill, with the action to say.

 

First check expression is set to: (true)

 

Second check expression is set to: limit.Activations() == 1

 

Say message (seems to work ok):

say_audience = All

say_message = %p_n% got first blood this round with a %w_n%!

 

I've managed to get a lot else working by playing around with the great examples provideded in this thread, a swear word filter, all sorts of filters above normal player stats, so really easy to use plug in, but these 2 just beat my very small ability...

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

Originally Posted by Itz_cujo666*:

 

example from here...*

 

We just run SQDM, so changed the first expression, I guess it's not working so well...? Maybe it just doesn't work with 4 squads? I also tweaked the second code, to change so it says top platoon, instead of clan. Since it's runnin in virtual, I see it firing in the parent layer control, and honestly speaking, I'm not convince the value for the winning platoon is correct, either...?

 

I followed instructions, so it evaluates on spawn, with no action selectedd.

 

First check expression:

(team1.RemainTicketsPercent

 

Second check code:

double count = limit.Activations();

 

if (count > 1)

return false;

 

List players = new List();

players.AddRange(team1.players);

players.AddRange(team2.players);

players.AddRange(team3.players);

players.AddRange(team4.players);

Dictionary clan_stats = new Dictionary();

 

/* 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 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 PLATOON this round is ["+ best_clan + "] with " + best_score + " points!";

plugin.SendGlobalMessage(message);

plugin.ConsoleWrite(message);

}

return false;

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

Originally Posted by Repoman*:

 

Is there a way to use vars.vehicleSpawnDelay 99999 instead of vars.vehicleSpawnAllowed for this limit? I don't want the server to switch to custom when using vars.vehicleSpawnAllowed.

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

Originally Posted by PapaCharlie9*:

 

Is there a way to use vars.vehicleSpawnDelay 99999 instead of vars.vehicleSpawnAllowed for this limit? I don't want the server to switch to custom when using vars.vehicleSpawnAllowed.

The Examples thread is for old examples only. Please posts your requests here:

 

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

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

Originally Posted by CPx4*:

 

Armored Kill

 

An update for the "@ShowNext" command (by Fruity & Singh400). I made my own modifications. (See my earlier post in this thread here*)

 

 

Add to the 'maps' section:

Code:

Maps.Add("XP3_Desert","Bandar Desert");
Maps.Add("XP3_Alborz","Alborz Mountains");
Maps.Add("XP3_Shield","Armored Shield");
Maps.Add("XP3_Valley","Death Valley");
Add to the 'modes' section:

Code:

Modes.Add("TankSuperiority0","Tank Superiority");
- CPx4
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Singh400*:

 

Armored Kill

 

An update for the "@ShowNext" command (by Fruity & Singh400). I made my own modifications. (See my earlier post in this thread here*)

 

 

Add to the 'maps' section:

Code:

Maps.Add("XP3_Desert","Bandar Desert");
Maps.Add("XP3_Alborz","Alborz Mountains");
Maps.Add("XP3_Shield","Armored Shield");
Maps.Add("XP3_Valley","Death Valley");
Add to the 'modes' section:

Code:

Modes.Add("TankSuperiority0","Tank Superiority");
- CPx4
https://github.com/Singh400/insane-l...xt-Map-Command :ohmy:
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

Crap! When did Armored Kill come out? Is this a Premium early access thing? I have to get my server updated.

 

Why do these things always come out when I have a ton of real-life work?

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

Originally Posted by HexaCanon*:

 

Crap! When did Armored Kill come out? Is this a Premium early access thing? I have to get my server updated.

 

Why do these things always come out when I have a ton of real-life work?

it is out on PS3 only, PC is 11th of sep.
* Restored post. It could be that the author is no longer active.
Link to comment
  • 2 weeks later...

Originally Posted by Greek*:

 

This limit allows players to use In-Game command "!votekick ". Players can vote as many times they want, and against as many players they want. The are no time or concurrency restrictions. However, votes are only counted once (you can only vote once against a certain player). If any player accumulates votes from more than 50% of all players in the server, that player is kicked. All votes are reset at the end of a round. The player name does not have to be a full-name. It can be a sub-string or misspelled name.

 

Set limit to evaluate OnAnyChat, set action to None

 

Set first_check to this Code

Code:

double percent = 50;

/* Verify that it is a command */
if (!plugin.IsInGameCommand(player.LastChat))
    return false;

/* Extract the command */
String command = plugin.ExtractInGameCommand(player.LastChat);

/* Sanity check the command */
if (command.Length == 0)
    return false;
    
/* Parse the command */
Match kickMatch = Regex.Match(command, @"^votekick\s+([^ ]+)", RegexOptions.IgnoreCase);

/* Bail out if not a vote-kick */
if (!kickMatch.Success)
    return false;
    
/* Extract the player name */
PlayerInfoInterface target = plugin.GetPlayer(kickMatch.Groups[1].Value.Trim(), true);

if (target == null)
    return false;
    
if (target.Name.Equals(player.Name))
{
    plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("player.Name, you cannot vote-kick yourself!"));
    return false;
}
    
/* Account the vote in the voter's dictionary */
/* Votes are kept with the voter, not the votee */
/* If the voter leaves, his votes are not counted */

if (!player.DataRound.issetObject("votekick"))
    player.DataRound.setObject("votekick", new Dictionary<String, bool>());

Dictionary<String, bool> vdict =  (Dictionary<String, bool>) player.DataRound.getObject("votekick");

if (!vdict.ContainsKey(target.Name))
    vdict.Add(target.Name, true);


/* Tally the votes against the target player */
double votes = 0;
List<PlayerInfoInterface> all = new List<PlayerInfoInterface>();
all.AddRange(team1.players);
all.AddRange(team2.players);
all.AddRange(team3.players);
all.AddRange(team4.players);

foreach(PlayerInfoInterface p in all)
    if (p.DataRound.issetObject("votekick"))
    {
       Dictionary<String, bool> pvotes = (Dictionary<String, bool>) p.DataRound.getObject("votekick");
       if (pvotes.ContainsKey(target.Name) && pvotes[target.Name])
           votes++;
    }

if (all.Count == 0)
    return false;
    
int needed = (int) Math.Ceiling((double) all.Count * (percent/100.0));
int remain = (int) ( needed - votes);

if (remain == 1)
   plugin.SendGlobalMessage(target.Name + " is about to get vote-kicked, 1 more vote needed");
else if (remain > 0)
   plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("player.Name, your vote against " + target.Name + " was counted, " + remain + " more needed to kick"));

if (remain > 0)
    plugin.ConsoleWrite(player.Name + ", is trying to vote-kick " + target.Name + ", " + remain + " more votes needed");

if (votes >= needed)
{
    String count = "with " + votes + " vote" + ((votes > 1)_"s":"");
    String message = target.Name + " was vote-kicked " + count ;
    plugin.SendGlobalMessage(message);
    plugin.ConsoleWrite(message);
    plugin.KickPlayerWithMessage(target.Name, target.Name + ", you were vote-kicked from the server " + count);
    return true;
}

return false;
is there a way to create a white list so players are not able to kick certain players (like admins or clan members)? thanks
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by HexaCanon*:

 

is there a way to create a white list so players are not able to kick certain players (like admins or clan members)? thanks

Code:
double percent = 50;

/* Verify that it is a command */
if (!plugin.IsInGameCommand(player.LastChat))
    return false;

/* Extract the command */
String command = plugin.ExtractInGameCommand(player.LastChat);

/* Sanity check the command */
if (command.Length == 0)
    return false;
    
/* Parse the command */
Match kickMatch = Regex.Match(command, @"^votekick\s+([^ ]+)", RegexOptions.IgnoreCase);

/* Bail out if not a vote-kick */
if (!kickMatch.Success)
    return false;
    
/* Extract the player name */
PlayerInfoInterface target = plugin.GetPlayer(kickMatch.Groups[1].Value.Trim(), true);

if (target == null)
    return false;

if (plugin.isInList(target.Name, "[b]List_Name[/b]")) {
    plugin.ServerCommand ( "admin.say" , plugin.R("player.Name, you cannot vote-kick " + target.Name), "player" , player.Name ) ;
    return false; }
    
if (target.Name.Equals(player.Name))
{
    plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("player.Name, you cannot vote-kick yourself!"));
    return false;
}
    
/* Account the vote in the voter's dictionary */
/* Votes are kept with the voter, not the votee */
/* If the voter leaves, his votes are not counted */

if (!player.DataRound.issetObject("votekick"))
    player.DataRound.setObject("votekick", new Dictionary<String, bool>());

Dictionary<String, bool> vdict =  (Dictionary<String, bool>) player.DataRound.getObject("votekick");

if (!vdict.ContainsKey(target.Name))
    vdict.Add(target.Name, true);


/* Tally the votes against the target player */
double votes = 0;
List<PlayerInfoInterface> all = new List<PlayerInfoInterface>();
all.AddRange(team1.players);
all.AddRange(team2.players);
all.AddRange(team3.players);
all.AddRange(team4.players);

foreach(PlayerInfoInterface p in all)
    if (p.DataRound.issetObject("votekick"))
    {
       Dictionary<String, bool> pvotes = (Dictionary<String, bool>) p.DataRound.getObject("votekick");
       if (pvotes.ContainsKey(target.Name) && pvotes[target.Name])
           votes++;
    }

if (all.Count == 0)
    return false;
    
int needed = (int) Math.Ceiling((double) all.Count * (percent/100.0));
int remain = (int) ( needed - votes);

if (remain == 1)
   plugin.SendGlobalMessage(target.Name + " is about to get vote-kicked, 1 more vote needed");
else if (remain > 0)
   plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("player.Name, your vote against " + target.Name + " was counted, " + remain + " more needed to kick"));

if (remain > 0)
    plugin.ConsoleWrite(player.Name + ", is trying to vote-kick " + target.Name + ", " + remain + " more votes needed");

if (votes >= needed)
{
    String count = "with " + votes + " vote" + ((votes > 1)_"s":"");
    String message = target.Name + " was vote-kicked " + count ;
    plugin.SendGlobalMessage(message);
    plugin.ConsoleWrite(message);
    plugin.KickPlayerWithMessage(target.Name, target.Name + ", you were vote-kicked from the server " + count);
    return true;
}

return false;
replace the List_name (red part) with the name of player list you want to not be able to being kicked (note you can add more than one list if you want tell me if you dont know how to).

 

it will send to the play who request a vote kick a message (player.Name, you cannot vote-kick " + target.Name)

 

you can modify the message or even add a punishment such as kill.

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

Originally Posted by Greek*:

 

Code:

double percent = 50;

/* Verify that it is a command */
if (!plugin.IsInGameCommand(player.LastChat))
    return false;

/* Extract the command */
String command = plugin.ExtractInGameCommand(player.LastChat);

/* Sanity check the command */
if (command.Length == 0)
    return false;
    
/* Parse the command */
Match kickMatch = Regex.Match(command, @"^votekick\s+([^ ]+)", RegexOptions.IgnoreCase);

/* Bail out if not a vote-kick */
if (!kickMatch.Success)
    return false;
    
/* Extract the player name */
PlayerInfoInterface target = plugin.GetPlayer(kickMatch.Groups[1].Value.Trim(), true);

if (target == null)
    return false;

if (plugin.isInList(target.Name, "[b]List_Name[/b]")) {
    plugin.ServerCommand ( "admin.say" , plugin.R("player.Name, you cannot vote-kick " + target.Name), "player" , player.Name ) ;
    return false; }
    
if (target.Name.Equals(player.Name))
{
    plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("player.Name, you cannot vote-kick yourself!"));
    return false;
}
    
/* Account the vote in the voter's dictionary */
/* Votes are kept with the voter, not the votee */
/* If the voter leaves, his votes are not counted */

if (!player.DataRound.issetObject("votekick"))
    player.DataRound.setObject("votekick", new Dictionary<String, bool>());

Dictionary<String, bool> vdict =  (Dictionary<String, bool>) player.DataRound.getObject("votekick");

if (!vdict.ContainsKey(target.Name))
    vdict.Add(target.Name, true);


/* Tally the votes against the target player */
double votes = 0;
List<PlayerInfoInterface> all = new List<PlayerInfoInterface>();
all.AddRange(team1.players);
all.AddRange(team2.players);
all.AddRange(team3.players);
all.AddRange(team4.players);

foreach(PlayerInfoInterface p in all)
    if (p.DataRound.issetObject("votekick"))
    {
       Dictionary<String, bool> pvotes = (Dictionary<String, bool>) p.DataRound.getObject("votekick");
       if (pvotes.ContainsKey(target.Name) && pvotes[target.Name])
           votes++;
    }

if (all.Count == 0)
    return false;
    
int needed = (int) Math.Ceiling((double) all.Count * (percent/100.0));
int remain = (int) ( needed - votes);

if (remain == 1)
   plugin.SendGlobalMessage(target.Name + " is about to get vote-kicked, 1 more vote needed");
else if (remain > 0)
   plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("player.Name, your vote against " + target.Name + " was counted, " + remain + " more needed to kick"));

if (remain > 0)
    plugin.ConsoleWrite(player.Name + ", is trying to vote-kick " + target.Name + ", " + remain + " more votes needed");

if (votes >= needed)
{
    String count = "with " + votes + " vote" + ((votes > 1)_"s":"");
    String message = target.Name + " was vote-kicked " + count ;
    plugin.SendGlobalMessage(message);
    plugin.ConsoleWrite(message);
    plugin.KickPlayerWithMessage(target.Name, target.Name + ", you were vote-kicked from the server " + count);
    return true;
}

return false;
replace the List_name (red part) with the name of player list you want to not be able to being kicked (note you can add more than one list if you want tell me if you dont know how to).

 

it will send to the play who request a vote kick a message (player.Name, you cannot vote-kick " + target.Name)

 

you can modify the message or even add a punishment such as kill.

how can I add a KICK as a punishment for starting a voteckick against server admins/members and also send a global message? thanks for your help
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by HexaCanon*:

 

how can I add a KICK as a punishment for starting a voteckick against server admins/members and also send a global message? thanks for your help

Code:
double percent = 50;

/* Verify that it is a command */
if (!plugin.IsInGameCommand(player.LastChat))
    return false;

/* Extract the command */
String command = plugin.ExtractInGameCommand(player.LastChat);

/* Sanity check the command */
if (command.Length == 0)
    return false;
    
/* Parse the command */
Match kickMatch = Regex.Match(command, @"^votekick\s+([^ ]+)", RegexOptions.IgnoreCase);

/* Bail out if not a vote-kick */
if (!kickMatch.Success)
    return false;
    
/* Extract the player name */
PlayerInfoInterface target = plugin.GetPlayer(kickMatch.Groups[1].Value.Trim(), true);

if (target == null)
    return false;

if (plugin.isInList(target.Name, "List_Name")) {
    [b]ADD ACTION HERE[/b]
    return false; }
    
if (target.Name.Equals(player.Name))
{
    plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("player.Name, you cannot vote-kick yourself!"));
    return false;
}
    
/* Account the vote in the voter's dictionary */
/* Votes are kept with the voter, not the votee */
/* If the voter leaves, his votes are not counted */

if (!player.DataRound.issetObject("votekick"))
    player.DataRound.setObject("votekick", new Dictionary<String, bool>());

Dictionary<String, bool> vdict =  (Dictionary<String, bool>) player.DataRound.getObject("votekick");

if (!vdict.ContainsKey(target.Name))
    vdict.Add(target.Name, true);


/* Tally the votes against the target player */
double votes = 0;
List<PlayerInfoInterface> all = new List<PlayerInfoInterface>();
all.AddRange(team1.players);
all.AddRange(team2.players);
all.AddRange(team3.players);
all.AddRange(team4.players);

foreach(PlayerInfoInterface p in all)
    if (p.DataRound.issetObject("votekick"))
    {
       Dictionary<String, bool> pvotes = (Dictionary<String, bool>) p.DataRound.getObject("votekick");
       if (pvotes.ContainsKey(target.Name) && pvotes[target.Name])
           votes++;
    }

if (all.Count == 0)
    return false;
    
int needed = (int) Math.Ceiling((double) all.Count * (percent/100.0));
int remain = (int) ( needed - votes);

if (remain == 1)
   plugin.SendGlobalMessage(target.Name + " is about to get vote-kicked, 1 more vote needed");
else if (remain > 0)
   plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("player.Name, your vote against " + target.Name + " was counted, " + remain + " more needed to kick"));

if (remain > 0)
    plugin.ConsoleWrite(player.Name + ", is trying to vote-kick " + target.Name + ", " + remain + " more votes needed");

if (votes >= needed)
{
    String count = "with " + votes + " vote" + ((votes > 1)_"s":"");
    String message = target.Name + " was vote-kicked " + count ;
    plugin.SendGlobalMessage(message);
    plugin.ConsoleWrite(message);
    plugin.KickPlayerWithMessage(target.Name, target.Name + ", you were vote-kicked from the server " + count);
    return true;
}

return false;
in the red "ADD ACTION HERE"

 

for killing votekick user add

Code:

plugin.KillPlayer(player.Name);
for global message add

Code:

message = plugin.R("%p_n%, you can not votekick an admin"); // edit text between "" // %p_n% is the name of the votekick user.
plugin.SendGlobalMessage(message);
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by droopie*:

 

This limit allows players to use In-Game command "!votekick ". Players can vote as many times they want, and against as many players they want. The are no time or concurrency restrictions. However, votes are only counted once (you can only vote once against a certain player). If any player accumulates votes from more than 50% of all players in the server, that player is kicked. All votes are reset at the end of a round. The player name does not have to be a full-name. It can be a sub-string or misspelled name.

 

Set limit to evaluate OnAnyChat, set action to None

 

Set first_check to this Code

Code:

double percent = 50;

/* Verify that it is a command */
if (!plugin.IsInGameCommand(player.LastChat))
    return false;

/* Extract the command */
String command = plugin.ExtractInGameCommand(player.LastChat);

/* Sanity check the command */
if (command.Length == 0)
    return false;
    
/* Parse the command */
Match kickMatch = Regex.Match(command, @"^votekick\s+([^ ]+)", RegexOptions.IgnoreCase);

/* Bail out if not a vote-kick */
if (!kickMatch.Success)
    return false;
    
/* Extract the player name */
PlayerInfoInterface target = plugin.GetPlayer(kickMatch.Groups[1].Value.Trim(), true);

if (target == null)
    return false;
    
if (target.Name.Equals(player.Name))
{
    plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("player.Name, you cannot vote-kick yourself!"));
    return false;
}
    
/* Account the vote in the voter's dictionary */
/* Votes are kept with the voter, not the votee */
/* If the voter leaves, his votes are not counted */

if (!player.DataRound.issetObject("votekick"))
    player.DataRound.setObject("votekick", new Dictionary<String, bool>());

Dictionary<String, bool> vdict =  (Dictionary<String, bool>) player.DataRound.getObject("votekick");

if (!vdict.ContainsKey(target.Name))
    vdict.Add(target.Name, true);


/* Tally the votes against the target player */
double votes = 0;
List<PlayerInfoInterface> all = new List<PlayerInfoInterface>();
all.AddRange(team1.players);
all.AddRange(team2.players);
all.AddRange(team3.players);
all.AddRange(team4.players);

foreach(PlayerInfoInterface p in all)
    if (p.DataRound.issetObject("votekick"))
    {
       Dictionary<String, bool> pvotes = (Dictionary<String, bool>) p.DataRound.getObject("votekick");
       if (pvotes.ContainsKey(target.Name) && pvotes[target.Name])
           votes++;
    }

if (all.Count == 0)
    return false;
    
int needed = (int) Math.Ceiling((double) all.Count * (percent/100.0));
int remain = (int) ( needed - votes);

if (remain == 1)
   plugin.SendGlobalMessage(target.Name + " is about to get vote-kicked, 1 more vote needed");
else if (remain > 0)
   plugin.SendSquadMessage(player.TeamId, player.SquadId, plugin.R("player.Name, your vote against " + target.Name + " was counted, " + remain + " more needed to kick"));

if (remain > 0)
    plugin.ConsoleWrite(player.Name + ", is trying to vote-kick " + target.Name + ", " + remain + " more votes needed");

if (votes >= needed)
{
    String count = "with " + votes + " vote" + ((votes > 1)_"s":"");
    String message = target.Name + " was vote-kicked " + count ;
    plugin.SendGlobalMessage(message);
    plugin.ConsoleWrite(message);
    plugin.KickPlayerWithMessage(target.Name, target.Name + ", you were vote-kicked from the server " + count);
    return true;
}

return false;
i have 2 questions,

 

does the voting count for the team or whole server?

 

if i change the percentage to like 25% in the first line, how will that effect the voting ie 25% of votes yes vs votes no OR 25% votes yes overall by side/server (i guess the side/server will be answered in my first question)

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

Originally Posted by TermiBr%FCll*:

 

Wie ist der Code für Simple Rank Limit, ab 90>?

Stehe etwas auf dem Schlauch, oder bin zu doof!

 

What is the code for Simple Rank limit, from 90>?

'm Somewhat at a loss, or am too stupid!

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

Originally Posted by HexaCanon*:

 

Wie ist der Code für Simple Rank Limit, ab 90>?

Stehe etwas auf dem Schlauch, oder bin zu doof!

 

What is the code for Simple Rank limit, from 90>?

'm Somewhat at a loss, or am too stupid!

Dies ist für Rang über 90

 

Code:

player.Rank > 90
* 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.




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