Release Votekick
#31
(04-10-2012, 07:53)OzonE Wrote: Mabye You Should Add !cancel For Admins To Avoid Players Kicking Admins Big Grin

you can add admins, mods and everyone you want to immunePlayers_xuid. But I think I can add that option if any admin wants to cancel the votekick.

I will do it when I have time.
Reply

#32
Also, you should try to do my idea...its probably not very hard. Its just a chat mechanism. It doesn't even have to do anything. Just have it like !vote Increase Speed? and then the message will appear and they type !vote y or !vote n and it will say how many people voted for it? That is all that I ask for. Or even if it says "Vote passed or Vote failed" Or the percent of players that said yes. Please? Smile thanks ahead of time!
Reply

#33
Plugin updated with !votecancel
(04-12-2012, 15:56)pollarpart Wrote: Also, you should try to do my idea...its probably not very hard. Its just a chat mechanism. It doesn't even have to do anything. Just have it like !vote Increase Speed? and then the message will appear and they type !vote y or !vote n and it will say how many people voted for it? That is all that I ask for. Or even if it says "Vote passed or Vote failed" Or the percent of players that said yes. Please? Smile thanks ahead of time!

It's easy to do it. I will do it when I have time. Thanks.
Reply

#34
more 10 Character name bug fix
Code:
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) { double s1 = vote.Agree.Count / (validPN.Count + 0.01); string s2 = s1.ToString("p"); string s3 = vote.Client.Name; int s4 = s3.Length; if (s4 <= 10) iPrintLnBold("^7(^1" + VoteTime / 50 + "s^7) ^6votekick ^3" + vote.Client.Name.Substring(0, s4) + "^6 in progress. ^2Agree " + s2 + " Percent ^6In chat Tpye ^3!vote yes ^6to yes", player); else iPrintLnBold("^7(^1" + VoteTime / 50 + "s^7) ^6votekick ^3" + vote.Client.Name.Substring(0, 10) + "^6 in progress. ^2Agree " + s2 + " Percent ^6In chat Tpye ^3!vote yes ^6to yes", player); } } }
Reply

#35
(04-18-2012, 11:42)jiuweiljp Wrote: more 10 Character name bug fix
Code:
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) { double s1 = vote.Agree.Count / (validPN.Count + 0.01); string s2 = s1.ToString("p"); string s3 = vote.Client.Name; int s4 = s3.Length; if (s4 <= 10) iPrintLnBold("^7(^1" + VoteTime / 50 + "s^7) ^6votekick ^3" + vote.Client.Name.Substring(0, s4) + "^6 in progress. ^2Agree " + s2 + " Percent ^6In chat Tpye ^3!vote yes ^6to yes", player); else iPrintLnBold("^7(^1" + VoteTime / 50 + "s^7) ^6votekick ^3" + vote.Client.Name.Substring(0, 10) + "^6 in progress. ^2Agree " + s2 + " Percent ^6In chat Tpye ^3!vote yes ^6to yes", player); } } }

What's that? That's not the message I have in votekick. I think it doesn't have that problem with the name/nick length.
Reply

#36

you try use name 15 Character
Reply

#37
Can someone please make a good Plugin for both votemap and votekick?
Reply

#38
If you find any bug/problem, tell me.

if you don't want to have immune xuids, just remove that line from sv_config.ini

updates:
- !votecancel was not working, now it works.
- votekick message was showing too fast for >10 char nicknames (limit is 15)
- if player that is being voted quits the game before the votekick ends, the votekick is aborted.

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.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) { players = GetClients(); foreach (ServerClient player in players) { if (player.Ping < 999 && player.Ping > 0) { iPrintLnBold("^7(^1" + VoteTime / 50 + "s^7) ^5votekick ^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); } else if (player.XUID.Equals(vote.Client.XUID)) { ServerSay("^7votekick: ^3Player ^2" + vote.Client.Name + " ^1left the game!", true); ServerSay("^1Votekick aborted", true); ResetVars(); } } } VoteTime--; if (VoteTime == 0 && vote.InProgress) { ServerPrint("Num Players:" + validPN + " Agree:" + vote.Agree.Count + " Percentage:" + (vote.Agree.Count / validPN.Count) * 100); if (((vote.Agree.Count / validPN.Count) * 100) > 50) { ServerCommand("kickclient " + vote.Client.ClientNum); ServerSay("^3Player ^7" + vote.Client.Name + "^3 got kicked" + vote.Reason, true); } else ServerSay("^3Not enough players agree to kick ^7" + vote.Client.Name, true); ResetVars(); } } } public override void OnServerLoad() { ServerPrint("VoteKick plugin loaded"); } 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 ^1" + Message.Substring(10).Split(' ')[1]; } ServerClient KickClient = GetClient(playerNumber); ServerSay("^7" + Client.Name + " ^3wants to kick ^7" + KickClient.Name + reason + "^3. 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.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; } 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; } return ChatType.ChatContinue; } public struct Vote { public bool InProgress; public string Reason; public ServerClient Client; public List<string> Agree; } private void PrintPlayerList(object cli) { votemsginterval = Convert.ToInt32(GetServerCFG("VOTEKICK", "votemsginterval", "5")) * 50; string immunePlayersXUID = GetServerCFG("VOTEKICK", "immunePlayers_xuid", ""); if (!immunePlayers.Equals("")) immunePlayers = new List<string>(immunePlayersXUID.ToLower().Split(',')); 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; } } }

(04-18-2012, 14:54)CJGreenLabel Wrote: Can someone please make a good Plugin for both votemap and votekick?

what do you mean by "good"? if you mean one that uses keys, forget it. not possible at the moment.


Attached Files
.zip   votekick.zip (Size: 4.26 KB / Downloads: 287)
Reply

#39
keeping update,great Big Grin
Reply

#40
Dear craftsmen who know how to compile a dll plugin that make it easier to vote affirmed the buttons f1 f2
Reply



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