Release Votekick
#1
Its a release, but its untested and i'm not sure if it works. You can edit it if you want to, just keep my name in the load message Narwhal
It was made for mw2 and worked afaik, i just modified it for mw3.

You can start a vote for any player with any reason.
60% has to vote for to kick the player and if you don't vote you automaticly vote against.

you can change the votetime and the cooldown time in your sv_config.ini:
Code:
[VOTEKICK] cooldown=30 votetime=15

Code:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Addon; namespace mw3_votekick { public class VoteKick : CPlugin { Vote vote; int Interval; int VoteTime; public override void OnServerFrame() { if ( Interval > 0 ) Interval--; if ( VoteTime > 0 ) { VoteTime--; if ( VoteTime == 0 && vote.InProgress ) { if ( vote.Agree.Count / GetClients().Count * 100 >= 60 ) { ServerCommand( "clientkick " + vote.Client.ClientNum ); ServerSay( "^3Player " + vote.Client.Name + " got kicked" + vote.Reason, true ); } else ServerSay( "^3Not enough players agree to kick " + vote.Client.Name, true ); VoteTime = 0; vote.Client = null; vote.Agree.Clear(); vote.InProgress = false; } } } public override void OnServerLoad() { ServerPrint( "VoteKick plugin loaded. Author: iAegle. Version 1.2" ); } public override ChatType OnSay( string Message, ServerClient Client ) { string lowMsg = Message.ToLower(); if ( lowMsg.StartsWith( "!votekick" ) ) { if ( Interval > 0 ) { TellClient( Client.ClientNum, "^3You can start a vote now! wait " + Interval + " seconds.", true ); return ChatType.ChatContinue; } if ( lowMsg.Length <= 10 ) TellClient( Client.ClientNum, "^3Usage: !votekick [Player Name]", true ); else if ( vote.InProgress ) TellClient( Client.ClientNum, "^3There's already a vote in progress!", true ); else { string player = Message.Substring( 10 ).Split( ' ' )[0]; string reason = ( Message.Substring( 10 ).Split( ' ' )[1] != null || Message.Substring( 10 ).Split( ' ' )[1] != "" ) ? " for " + Message.Substring( 10 ).Split( ' ' )[1] : ""; ServerClient KickClient = GetClientByName( player ); ServerSay( "^3" + Client.Name + " wants to kick " + KickClient.Name + " for " + reason + ". Please vote: ^2Y^3es or ^1N^3o", true ); vote.Client = KickClient; vote.Agree = new List<ServerClient>(); vote.Agree.Add( Client ); vote.InProgress = true; vote.Reason = reason; VoteTime = Convert.ToInt32( GetServerCFG( "VOTEKICK", "votetime", "15" ) ) * 50; Interval = Convert.ToInt32( GetServerCFG( "VOTEKICK", "cooldown", "30" ) ) * 50 + VoteTime; } return ChatType.ChatContinue; } else if ( lowMsg.StartsWith( "!currentvote" ) ) { if ( !vote.InProgress ) { TellClient( Client.ClientNum, "^3There is currently no vote in progress.", true ); return ChatType.ChatContinue; } string s = "^3Kick: " + vote.Client.Name + "\r\n"; s += ( vote.Agree.Count / GetClients().Count * 100 ).ToString() + "% of the players agree"; TellClient( Client.ClientNum, s, true ); return ChatType.ChatContinue; } else if ( lowMsg.StartsWith( "!vote" ) ) { if ( !vote.InProgress ) { TellClient( Client.ClientNum, "^3There is currently no vote in progress.", true ); return ChatType.ChatContinue; } if ( lowMsg.Length <= 6 ) TellClient( Client.ClientNum, "^3Usage: !vote [Yes/No]", true ); else if ( ( lowMsg.Substring( 6 ) == "y" || lowMsg.Substring( 6 ) == "yes" ) && !vote.Agree.Contains( Client ) ) { vote.Agree.Add( Client ); TellClient( Client.ClientNum, "^3You agreed with kicking " + vote.Client.Name, true ); } else if ( ( lowMsg.Substring( 6 ) == "n" || lowMsg.Substring( 6 ) == "no" ) && vote.Agree.Contains( Client ) ) { vote.Agree.Add( Client ); TellClient( Client.ClientNum, "^3You voted against kicking " + vote.Client.Name, true ); } else TellClient( Client.ClientNum, "^3Invalid argument \"" + lowMsg.Substring( 6 ) + "\"", true ); return ChatType.ChatContinue; } return ChatType.ChatContinue; } public ServerClient GetClientByName( string name ) // thanks to pozzuh { if ( name == null || name == "" ) return null; ServerClient Client = null; for ( int i = 0 ; i < Convert.ToInt32( GetDvar( "sv_maxclients" ) ) ; i++ ) { Client = GetClient( i ); if ( Client == null ) continue; if ( Client.Name.StartsWith( name, StringComparison.InvariantCultureIgnoreCase ) ) return Client; else if ( Client.Name.ToLower().Contains( name.ToLower() ) ) return Client; } return null; } public struct Vote { public bool InProgress; public string Reason; public ServerClient Client; public List<ServerClient> Agree; } } }



Attached Files
.rar   Debug.rar (Size: 57.53 KB / Downloads: 1,118)
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#2
that's why you should always play with russian letter / some unicode character that you can't enter ingame Troll
[Image: lQDUjba.jpg]
Reply

#3
@OrangePL Anonymous ftw!
Reply

#4
(01-06-2012, 18:08)jariz Wrote: @OrangePL Anonymous ftw!
Yeah unfortunately not possible in 100 % in MW Tree, you can make your name invisible when you type in chat, but it will still show as some weird A in score tab
[Image: lQDUjba.jpg]
Reply

#5
Is it possible to make access for votestart only for admins and moders?
Reply

#6
(01-10-2012, 09:34)14m3r Wrote: Is it possible to make access for votestart only for admins and moders?

Yes use this with @Pozzuh's Permission Plugin from here http://www.itsmods.com/forum/Thread-Rele...lugin.html
[Image: azuw.jpg]
Reply

#7
Im install it, but i dont know how can i use votekick permitions in cfg. Can you show me example?
Reply

#8
(01-10-2012, 11:16)14m3r Wrote: Im install it, but i dont know how can i use votekick permitions in cfg. Can you show me example?
It should be like this in sv_config.ini
Code:
//Don't add spaces after commas! //CASE SENSITIVE! //Don't remove the User & Admin groups! [Permission] //You can add more user groups here Usergroups=Admin,Moderator,User //Add admin xuids here (Go ingame and use !getxuid) Admin_xuids=xuid1,xuid2,xuid3 //Admins can use all commands (Do not change!). Admin_commands=*ALL* //Add moderator xuids here Moderator_xuids=xuid1,xuid2,xuid3 //Add commands moderators can use here Moderator_commands=!help,!getxuid,!gettype,!votekick //Add commands everyone can use User_commands=!help,!getxuid,!gettype //Everyone who isn't in any other group is a user (Do not change!). User_xuids=*EVERYONE*
See I added !votekick to Moderator_commands.

Don't forget to add the xuids to Admin_xuids and Moderator_xuids.
[Image: azuw.jpg]
Reply

#9
Where does the addon.dll go? I know there is another addon.dll file are you supposed to overwrite that? [/align]
Reply

#10
Tested this and it seems to not work.


Guessing outdated :/[/u]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Votekick and VoteBan 4d1 gauthier.verrons 1 2,381 06-20-2013, 09:05
Last Post: surtek

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.