Release Votekick
#61
(10-12-2012, 17:36)lvl Wrote: hi guys
how are you
my friend runing a server in call of duty MWF 3
he's kindly new and he dont know how open a election for change map or kick someone ( cheaters )
could you help me and tell me how can i do it for him step by step ?
we copied :
[VOTEKICK]
cooldown=60
votetime=45
votemsginterval=4

in the " sv_config.ini " but how to use it , we dont know
could you kindly help us and tell us how to use a command in our server ???
add the plugin into server folder\Plugins
add the settings into server folder\addon\sv_config.ini
to vote kick someone:
1: Type !status get his or her ID
2: type !votekick ID Reason
Example !votekick 5 Cheater
Players can vote !vy - Yes or !vn - NO
Reply

#62
PHP Code:
[quote='VSpeed' pid='69969' dateline='1333641149'] version with immune XUIDs here. I didn't tested it too much, so if you find any bug/problem, tell me. changed some messages too to be more clear, I hope. if you don't want to have immune xuids, just remove that line f
rom sv_config.ini

edit: changed the vote in progress message a little.
edit2: changed the vote in progress message again. It was too big and was not showing because of that.
edit3 (12/04/2012): added !votecancel and changed some things a little. Use this with Permission Plugin

sv_config.ini
Code:
[VOTEKICK] cooldown=60 votetime=45 votemsginterval=4 //separate xuids with , don't add a space after that. ex: 000000100010000,000000100010000 immunePlayers_xuid=xuid1,xuid2

Code:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Addon; using System.Threading; namespace mw3_votekick { public class VoteKick : CPlugin { Vote vote; int Interval; int VoteTime; int votemsginterval; List<string> immunePlayers = new List<string>(); List<int> validPN; List<ServerClient> players = new List<ServerClient>(); public override void OnServerFrame() { if (Interval > 0) Interval--; if (VoteTime > 0) { if (VoteTime % votemsginterval == 0) { foreach (ServerClient player in players) { if (player.Ping < 999 && player.Ping > 0) { iPrintLnBold("^1(" + VoteTime / 50 + "s) ^5votekick player ^7" + vote.Client.Name + " ^5in progress. ^3!vote [^2Y^3/^1N^3] ^0| ^2(" + vote.Agree.Count + ")Yes ^1(" + (validPN.Count - vote.Agree.Count) + ")No", player); } } } VoteTime--; if (VoteTime == 0 && vote.InProgress) { if (((vote.Agree.Count / validPN.Count) * 100) > 50) { ServerCommand("kickclient " + 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); ResetVars(); } } } public override void OnServerLoad() { ServerPrint("VoteKick plugin loaded"); votemsginterval = Convert.ToInt32(GetServerCFG("VOTEKICK", "votemsginterval", "5")) * 50; string immunePlayersXUID = GetServerCFG("VOTEKICK", "immunePlayers_xuid", ""); if (!immunePlayers.Equals("")) immunePlayers = new List<string>(immunePlayersXUID.ToLower().Split(',')); } public override ChatType OnSay(string Message, ServerClient Client) { string lowMsg = Message.ToLower(); int playerNumber = -1; int tmpPN = -1; if (lowMsg.StartsWith("!votekick")) { if (Interval > 0) { TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true); return ChatType.ChatNone; } if (players.Count <= 0) { TellClient(Client.ClientNum, "^3You must use ^2!status ^3first to see the ^2number ^3of the player you want to kick", true); } else if (vote.InProgress) { TellClient(Client.ClientNum, "^3There's already a vote in progress!", true); } else if (lowMsg.Length <= 12) { TellClient(Client.ClientNum, "^3Usage: ^2!votekick [Player Number] [Reason]", true); } else { if (int.TryParse(Message.Substring(10).Split(' ')[0], out tmpPN) == false) { TellClient(Client.ClientNum, "^1Invalid Player Number. Please enter a valid number.", true); } else if (!validPN.Contains(tmpPN)) { TellClient(Client.ClientNum, "^1Invalid Player Number. Please enter a valid number.", true); } else { playerNumber = tmpPN; string reason = ""; if (!Message.Substring(10).Split(' ')[1].Equals("")) { reason = " ^3for " + Message.Substring(10).Split(' ')[1]; } ServerClient KickClient = GetClient(playerNumber); ServerSay("^7" + Client.Name + " ^3wants to kick ^7" + KickClient.Name + reason + ". Please type !vote ^2Y ^3or ^1N ^3to vote", true); vote.Agree = new List<string>(); vote.Client = KickClient; vote.Agree.Add(Client.XUID); vote.InProgress = true; vote.Reason = reason; VoteTime = Convert.ToInt32(GetServerCFG("VOTEKICK", "votetime", "15")) * 50; } } return ChatType.ChatNone; } else if (lowMsg.StartsWith("!vote")) { if (!vote.InProgress) { TellClient(Client.ClientNum, "^3There is currently no vote in progress.", true); } else if (lowMsg.Length <= 6) TellClient(Client.ClientNum, "^3Usage: ^2!vote [^2Y^0/^1N^2]", true); else if ((lowMsg.Substring(6) == "y" || lowMsg.Substring(6) == "yes")) { if (!vote.Agree.Contains(Client.XUID)) { vote.Agree.Add(Client.XUID); TellClient(Client.ClientNum, "^3You ^2agreed ^3with kicking ^7" + vote.Client.Name, true); } else { TellClient(Client.ClientNum, "^3You already agreed with kicking ^7" + vote.Client.Name, true); } } else if ((lowMsg.Substring(6) == "n" || lowMsg.Substring(6) == "no") && vote.Agree.Contains(Client.XUID)) { vote.Agree.Remove(Client.XUID); TellClient(Client.ClientNum, "^3You voted ^1against ^3kicking ^7" + vote.Client.Name, true); } else { TellClient(Client.ClientNum, "^3Invalid argument \"" + lowMsg.Substring(6) + "\"", true); TellClient(Client.ClientNum, "^3use ^2Y ^3or ^1N", true); } return ChatType.ChatNone; } else if (lowMsg.Equals("!status")) { if (vote.InProgress) { TellClient(Client.ClientNum, "^3There's already a vote in progress!", true); } else { Thread thread = new Thread(PrintPlayerList); thread.Start(Client); } return ChatType.ChatNone; } else if (lowMsg.Equals("!votecancel")) { if (!vote.InProgress) { TellClient(Client.ClientNum, "^3No votekick in progress", true); } else { ServerSay("^3Votekick player ^7" + vote.Client.Name + " ^1cancelled", true); ResetVars(); } return ChatType.ChatNone; } return ChatType.ChatContinue; } public struct Vote { public bool InProgress; public string Reason; public ServerClient Client; public List<string> Agree; } private void PrintPlayerList(object cli) { ServerClient Client = (ServerClient)cli; players = GetClients(); TellClient(Client.ClientNum, "^2[Player Number] ^0- ^3[Player Name]", true); Thread.Sleep(500); validPN = new List<int>(); foreach (ServerClient player in players) { //remove inactive and immune players from the list if ((player.Ping < 999) && (player.Ping > 0) && !(immunePlayers.Contains(player.XUID))) { TellClient(Client.ClientNum, "^2" + player.ClientNum + " ^0- " + "^3" + player.Name, true); validPN.Add(player.ClientNum); Thread.Sleep(1000); } } } private void ResetVars() { //reset vars players.Clear(); validPN.Clear(); VoteTime = 0; vote.Client = null; vote.Agree.Clear(); vote.InProgress = false; vote.Reason = ""; //set cooldown timer Interval = Convert.ToInt32(GetServerCFG("VOTEKICK", "cooldown", "30")) * 50; } } }
[/quote]

Hey man!
Your plugin I can translate to spanish?
Please me and tried but does not work.
Greetings, Thanks

this is what I managed to translate
just need to compile.


Attached Files
.txt   Votekick_translate.txt (Size: 8.93 KB / Downloads: 74)
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Votekick and VoteBan 4d1 gauthier.verrons 1 2,380 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.