Post Reply 
 
Thread Rating:
  • 7 Votes - 3.14 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release Votekick
10-13-2012, 22:51 (This post was last modified: 10-13-2012 22:52 by trimi_dogg.)
Post: #61
RE: Votekick
(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
Related links
Find all posts by this user
Add Thank You Quote this message in a reply
10-24-2012, 21:40
Post: #62
RE: Votekick
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 xuidsjust 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

CSHARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Addon;
  6. using System.Threading;
  7.  
  8. namespace mw3_votekick
  9. {
  10. public class VoteKick : CPlugin
  11. {
  12. Vote vote;
  13. int Interval;
  14. int VoteTime;
  15. int votemsginterval;
  16.  
  17. List<string> immunePlayers = new List<string>();
  18.  
  19. List<int> validPN;
  20.  
  21. List<ServerClient> players = new List<ServerClient>();
  22.  
  23. public override void OnServerFrame()
  24. {
  25.  
  26. if (Interval > 0)
  27. Interval--;
  28.  
  29. if (VoteTime > 0)
  30. {
  31. if (VoteTime % votemsginterval == 0)
  32. {
  33. foreach (ServerClient player in players)
  34. {
  35. if (player.Ping < 999 && player.Ping > 0)
  36. {
  37. 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);
  38. }
  39. }
  40. }
  41.  
  42. VoteTime--;
  43.  
  44. if (VoteTime == 0 && vote.InProgress)
  45. {
  46.  
  47. if (((vote.Agree.Count / validPN.Count) * 100) > 50)
  48. {
  49. ServerCommand("kickclient " + vote.Client.ClientNum);
  50. ServerSay("^3Player " + vote.Client.Name + " got kicked" + vote.Reason, true);
  51. }
  52. else
  53. ServerSay("^3Not enough players agree to kick " + vote.Client.Name, true);
  54.  
  55. ResetVars();
  56. }
  57. }
  58. }
  59.  
  60. public override void OnServerLoad()
  61. {
  62. ServerPrint("VoteKick plugin loaded");
  63.  
  64. votemsginterval = Convert.ToInt32(GetServerCFG("VOTEKICK", "votemsginterval", "5")) * 50;
  65. string immunePlayersXUID = GetServerCFG("VOTEKICK", "immunePlayers_xuid", "");
  66.  
  67. if (!immunePlayers.Equals(""))
  68. immunePlayers = new List<string>(immunePlayersXUID.ToLower().Split(','));
  69. }
  70.  
  71. public override ChatType OnSay(string Message, ServerClient Client)
  72. {
  73.  
  74. string lowMsg = Message.ToLower();
  75.  
  76. int playerNumber = -1;
  77. int tmpPN = -1;
  78.  
  79. if (lowMsg.StartsWith("!votekick"))
  80. {
  81. if (Interval > 0)
  82. {
  83. TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
  84. return ChatType.ChatNone;
  85. }
  86.  
  87. if (players.Count <= 0)
  88. {
  89. TellClient(Client.ClientNum, "^3You must use ^2!status ^3first to see the ^2number ^3of the player you want to kick", true);
  90. }
  91. else if (vote.InProgress)
  92. {
  93. TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
  94. }
  95. else if (lowMsg.Length <= 12)
  96. {
  97. TellClient(Client.ClientNum, "^3Usage: ^2!votekick [Player Number] [Reason]", true);
  98. }
  99. else
  100. {
  101. if (int.TryParse(Message.Substring(10).Split(' ')[0], out tmpPN) == false)
  102. {
  103. TellClient(Client.ClientNum, "^1Invalid Player Number. Please enter a valid number.", true);
  104. }
  105.  
  106. else if (!validPN.Contains(tmpPN))
  107. {
  108. TellClient(Client.ClientNum, "^1Invalid Player Number. Please enter a valid number.", true);
  109. }
  110. else
  111. {
  112. playerNumber = tmpPN;
  113. string reason = "";
  114.  
  115. if (!Message.Substring(10).Split(' ')[1].Equals(""))
  116. {
  117. reason = " ^3for " + Message.Substring(10).Split(' ')[1];
  118. }
  119.  
  120. ServerClient KickClient = GetClient(playerNumber);
  121.  
  122. ServerSay("^7" + Client.Name + " ^3wants to kick ^7" + KickClient.Name + reason + ". Please type !vote ^2Y ^3or ^1N ^3to vote", true);
  123.  
  124. vote.Agree = new List<string>();
  125. vote.Client = KickClient;
  126. vote.Agree.Add(Client.XUID);
  127. vote.InProgress = true;
  128. vote.Reason = reason;
  129. VoteTime = Convert.ToInt32(GetServerCFG("VOTEKICK", "votetime", "15")) * 50;
  130. }
  131. }
  132.  
  133. return ChatType.ChatNone;
  134. }
  135. else if (lowMsg.StartsWith("!vote"))
  136. {
  137.  
  138. if (!vote.InProgress)
  139. {
  140. TellClient(Client.ClientNum, "^3There is currently no vote in progress.", true);
  141. }
  142. else if (lowMsg.Length <= 6)
  143. TellClient(Client.ClientNum, "^3Usage: ^2!vote [^2Y^0/^1N^2]", true);
  144. else if ((lowMsg.Substring(6) == "y" || lowMsg.Substring(6) == "yes"))
  145. {
  146. if (!vote.Agree.Contains(Client.XUID))
  147. {
  148. vote.Agree.Add(Client.XUID);
  149. TellClient(Client.ClientNum, "^3You ^2agreed ^3with kicking ^7" + vote.Client.Name, true);
  150. }
  151. else
  152. {
  153. TellClient(Client.ClientNum, "^3You already agreed with kicking ^7" + vote.Client.Name, true);
  154. }
  155. }
  156. else if ((lowMsg.Substring(6) == "n" || lowMsg.Substring(6) == "no") && vote.Agree.Contains(Client.XUID))
  157. {
  158. vote.Agree.Remove(Client.XUID);
  159. TellClient(Client.ClientNum, "^3You voted ^1against ^3kicking ^7" + vote.Client.Name, true);
  160. }
  161. else
  162. {
  163. TellClient(Client.ClientNum, "^3Invalid argument \"" + lowMsg.Substring(6) + "\"", true);
  164. TellClient(Client.ClientNum, "^3use ^2Y ^3or ^1N", true);
  165. }
  166.  
  167. return ChatType.ChatNone;
  168. }
  169. else if (lowMsg.Equals("!status"))
  170. {
  171. if (vote.InProgress)
  172. {
  173. TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
  174. }
  175. else
  176. {
  177. Thread thread = new Thread(PrintPlayerList);
  178. thread.Start(Client);
  179. }
  180.  
  181. return ChatType.ChatNone;
  182. }
  183. else if (lowMsg.Equals("!votecancel"))
  184. {
  185. if (!vote.InProgress)
  186. {
  187. TellClient(Client.ClientNum, "^3No votekick in progress", true);
  188. }
  189. else
  190. {
  191. ServerSay("^3Votekick player ^7" + vote.Client.Name + " ^1cancelled", true);
  192.  
  193. ResetVars();
  194. }
  195. return ChatType.ChatNone;
  196. }
  197.  
  198. return ChatType.ChatContinue;
  199. }
  200.  
  201. public struct Vote
  202. {
  203. public bool InProgress;
  204. public string Reason;
  205. public ServerClient Client;
  206. public List<string> Agree;
  207. }
  208.  
  209. private void PrintPlayerList(object cli)
  210. {
  211. ServerClient Client = (ServerClient)cli;
  212.  
  213. players = GetClients();
  214.  
  215. TellClient(Client.ClientNum, "^2[Player Number] ^0- ^3[Player Name]", true);
  216.  
  217. Thread.Sleep(500);
  218.  
  219. validPN = new List<int>();
  220.  
  221. foreach (ServerClient player in players)
  222. {
  223. //remove inactive and immune players from the list
  224. if ((player.Ping < 999) && (player.Ping > 0) && !(immunePlayers.Contains(player.XUID)))
  225. {
  226. TellClient(Client.ClientNum, "^2" + player.ClientNum + " ^0- " + "^3" + player.Name, true);
  227. validPN.Add(player.ClientNum);
  228. Thread.Sleep(1000);
  229. }
  230. }
  231. }
  232.  
  233. private void ResetVars()
  234. {
  235. //reset vars
  236. players.Clear();
  237. validPN.Clear();
  238. VoteTime = 0;
  239. vote.Client = null;
  240. vote.Agree.Clear();
  241. vote.InProgress = false;
  242. vote.Reason = "";
  243.  
  244. //set cooldown timer
  245. Interval = Convert.ToInt32(GetServerCFG("VOTEKICK", "cooldown", "30")) * 50;
  246. }
  247.  
  248. }
  249. }

[/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 File(s)
.txt  Votekick_translate.txt (Size: 8.93 KB / Downloads: 28)
Find all posts by this user
Add Thank You Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)
Media Embeding by Simple Audio Video Embeder