Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[REQUEST] Anti-Vote Abuse
#21
@hillbilly I'm at work now so i'll post the source tonight, but the only change i've done was taking off the "!" at line 95.
Replace this:
CSHARP Code
  1. if (!this.Players_No_Vote.Contains(Client.XUID))


By this:
CSHARP Code
  1. if (this.Players_No_Vote.Contains(Client.XUID))


@NooB_StalkeR Normal players can not votekick an admin, it cancel the vote, but an admin can votekick an admin.

When a player vote, i store his datetime, if the next vote is before the last datetime + the interval i warn the voter and cancel his vote. otherwise the vote is correct. (I also set the datetime when the player connect, so when he connects he have to wait the interval to be able to vote without warning, if you don't want that i can change it...)

I think it is not possible to know (at the moment) if the vote pass or if it is rejected, i need @zxz0O0 confirmation/help.

I'll do some more work on it to get a more configurable plugin, but i don't promise a release tonight, because of my wife Wink
Reply

#22
sorry to be a pain, but is it possible to add immune mods as well as Admins?
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

Reply

#23
I dont know if your'e still interrested in this or not.

But if so could you please add:

-Manual VoteBan (ie !vban name) with partial names like regular ban
-Add vote immunity for player (ie !vi name)
-Look into whether called/passed/failed votes are in the logs somewhere, maybe the new logger plugin would help. And if a voting rep system is possible?

I am not aware of anyone being vote banned on my server and people call wrongfull votes over and over. Im getting close to blocking votes because "good" regulars keep getting harrassed by it. So manul voteban and immunity would help. Not complaing or anything I appreciate the work.


Also, do you believe it would be possible to use a votekick plugin that uses f1 and f2 rather than typing in !votekick name !y !n and could be called from the menu as normal. This could make voterep possible because your plugin would just override the default !votekick. Or a logger plugin that monitors votes?

Thanks
Reply

#24
iv'e had to remove it due to vote spamming even though it has an anti-vote spamming feature. Looks like another good idea that has been forgotten about.
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

Reply

#25
What happened with this plugin?
Is not it possible to create it?
It is very important for administrators
[Image: b_560_95_1.png]
Reply

#26
Hi,

I had some busy days, but i'm back Wink
I'll work on it now to add more stuff and configurable options...
Reply

#27
Hi Wink

New stuff, you can now:
- configure the displayed messages. (4 differents messages)
- choose if the moderators from permission plugin are immunized or not
- add immunized players (xuids)
- configure the number of warn before vote-ban a player
- use "!vi PlayerName" in-game to add a player to the immunized list (it will be saved in the sv_config.ini).

Add "!vi" to the allowed commands in permission plugin (for moderators).

Add those line to the "sv_config.ini":
CSHARP Code
  1. Vote_Interval=60
  2. // Minimum time in seconds between 2 votes // No interval for admins <img src="https://www.itsmods.com/forum/images/smilies/wink.gif" alt="Wink" title="Wink" class="smilie smilie_2" />
  3. Immunize_Moderators=1
  4. // 1 = The moderators from permission plugin will be vote-kick immunized, 0 = not
  5. Immunized_Xuids=
  6. // A list of Immunized players xuids separated by comas
  7. Warns_Nbr=3
  8. // Maximum number of warn before vote-ban a player
  9. Ban_Message=^1You have been vote banned! You can no more vote on this server!
  10. // The message that will be displayed to players when they get vote-banned
  11. Warn_Message=^1No spam vote!!! @WARN_LEFT@ more spam in the interval of @VOTE_INTERVAL@ seconds = Vote Banned!
  12. // The message that will be displayed to players when they get vote-warned, (don't forget to keep the @WARN_LEFT@ and the @VOTE_INTERVAL@ tokens if you want them to be displayed in the message...)
  13. Try_Admin_Kick_Message=^1Don't try to kick an admin!!! @WARN_LEFT@ more in the interval of @VOTE_INTERVAL@ seconds = Vote Banned!
  14. // The message that will be displayed to players when they try to kick an admin
  15. Try_Immunized_Kick_Message=^1Don't try to kick an immunized player (@PLAYER_NAME@)!!! @WARN_LEFT@ more in the interval of @VOTE_INTERVAL@ seconds = Vote Banned!
  16. // The message that will be displayed to players when they try to kick an immunized player


I haven't tested it, try it and let me know...

Csharp source code:
CSHARP Code
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using Addon;
  6.  
  7. namespace AntiVoteAbuse
  8. {
  9. public class AntiVoteAbuse : CPlugin
  10. {
  11. //* Attributs
  12. // Store the datetime of the latest vote of each players
  13. private DateTime[] Players_Last_Vote = new DateTime[18];
  14.  
  15. // Store the admins xuids
  16. private ArrayList Admins = new ArrayList();
  17.  
  18. // Store the xuids of the immunized players
  19. private ArrayList Immunized_Xuids = new ArrayList();
  20.  
  21. // Store the players that can no more use vote
  22. private ArrayList Players_No_Vote = new ArrayList();
  23.  
  24. // Store the players vote spam ticks
  25. private int[] Players_Spam_Vote_Ticks = new int[18];
  26.  
  27. // Minimum time in seconds between 2 votes ( No interval for admins yeahhh )
  28. private int Vote_Interval = 60;
  29.  
  30. // Maximum number of warn before vote-ban a player
  31. private int Warns_Nbr = 3;
  32.  
  33. // Vote-ban message
  34. private string Ban_Message = "^1You have been vote banned! You can no more vote on this server!";
  35.  
  36. // Vote-warn message
  37. private string Warn_Message = "^1No spam vote!!! @WARN_LEFT@ more spam in the interval of @VOTE_INTERVAL@ seconds = Vote Banned!";
  38.  
  39. // Vote-warn "try to kick an admin" message
  40. private string Try_Admin_Kick_Message = "^1Don't try to kick an admin!!! @WARN_LEFT@ more in the interval of @VOTE_INTERVAL@ seconds = Vote Banned!";
  41.  
  42. // Vote-warn "try to kick an immunized player" message
  43. private string Try_Immunized_Kick_Message = "^1Don't try to kick an immunized player (@PLAYER_NAME@)!!! @WARN_LEFT@ more in the interval of @VOTE_INTERVAL@ seconds = Vote Banned!";
  44.  
  45. //* Functions
  46. // OnServerLoad
  47. public override void OnServerLoad()
  48. {
  49. try
  50. {
  51. // Get the admins xuids from permission plugin
  52. string[] get_admins = GetServerCFG("Permission", "Admin_xuids", "").Split(',');
  53.  
  54. // Loop the admins to add them to the list
  55. foreach (string admin in get_admins)
  56. {
  57. this.Admins.Add(admin);
  58. }
  59.  
  60. // Get if the mods of permission plugin are immunized
  61. int Immunize_Moderators = Int32.Parse(GetServerCFG("AntiVoteAbuse", "Immunize_Moderators", "1"));
  62. if (Immunize_Moderators == 1)
  63. {
  64. // Get the moderators xuids from permission plugin
  65. string[] get_moderators = GetServerCFG("Permission", "Moderator_xuids", "").Split(',');
  66. // Loop the admins and add them to the list
  67. foreach (string moderator in get_moderators)
  68. {
  69. this.Immunized_Xuids.Add(moderator);
  70. }
  71. }
  72.  
  73. // Get the immunized players xuids
  74. string[] get_immunized_xuids = GetServerCFG("AntiVoteAbuse", "Immunized_Xuids", "").Split(',');
  75. // loop the immunized players xuids and add them to the list
  76. foreach (string xuid in get_immunized_xuids)
  77. {
  78. this.Immunized_Xuids.Add(xuid);
  79. }
  80.  
  81. // Get the Interval between 2 votes
  82. this.Vote_Interval = Int32.Parse(GetServerCFG("AntiVoteAbuse", "Vote_Interval", "60"));
  83.  
  84. // Get the number of warn before vote-ban a player
  85. this.Warns_Nbr = Int32.Parse(GetServerCFG("AntiVoteAbuse", "Warns_Nbr", "3"));
  86.  
  87. // Get the vote-ban message
  88. this.Ban_Message = GetServerCFG("AntiVoteAbuse", "Ban_Message", "^1You have been vote banned! You can no more vote on this server!");
  89.  
  90. // Get the vote-warn message
  91. this.Warn_Message = GetServerCFG("AntiVoteAbuse", "Warn_Message", "^1No spam vote!!! @WARN_LEFT@ more spam in the interval of @VOTE_INTERVAL@ seconds = Vote Banned!");
  92.  
  93. // Get the try to kick an admin message
  94. this.Try_Admin_Kick_Message = GetServerCFG("AntiVoteAbuse", "Try_Admin_Kick_Message", "^1Don't try to kick an admin!!! @WARN_LEFT@ more in the interval of @VOTE_INTERVAL@ seconds = Vote Banned!");
  95.  
  96. // Get the try to kick an immunized player message
  97. this.Try_Immunized_Kick_Message = GetServerCFG("AntiVoteAbuse", "Try_Immunized_Kick_Message", "^1Don't try to kick an immunized player (@PLAYER_NAME@)!!! @WARN_LEFT@ more in the interval of @VOTE_INTERVAL@ seconds = Vote Banned!");
  98.  
  99. // Indicate that the plugin is loaded.
  100. ServerPrint("Plugin AntiVoteAbuse loaded! Author: Narkos");
  101. }
  102. catch(Exception e)
  103. {
  104. ServerPrint("Plugin AntiVoteAbuse: OnServerLoad catched exception: " + e.Message);
  105. }
  106. }
  107.  
  108. // OnPlayerConnect
  109. public override void OnPlayerConnect(ServerClient Client)
  110. {
  111. try
  112. {
  113. // Set the Players_Last_Vote of the player (Connecting to the server is like doing a vote, you have to wait an interval to be able to vote)
  114. this.Players_Last_Vote[Client.ClientNum] = DateTime.Now;
  115. }
  116. catch(Exception e)
  117. {
  118. ServerPrint("Plugin AntiVoteAbuse: OnPlayerConnect catched exception: " + e.Message);
  119. }
  120. }
  121.  
  122. // OnPlayerDisconnect
  123. public override void OnPlayerDisconnect(ServerClient Client)
  124. {
  125. try
  126. {
  127. // Set the player ticks to 0
  128. this.Players_Spam_Vote_Ticks[Client.ClientNum] = 0;
  129.  
  130. // If the player is vote banned, delete him or keep him banned???
  131. /*if (this.Players_No_Vote.Contains(Client.XUID))
  132.   {
  133.   this.Players_No_Vote.Remove(Client.XUID);
  134.   }*/
  135. }
  136. catch (Exception e)
  137. {
  138. ServerPrint("Plugin AntiVoteAbuse: OnPlayerDisconnect catched exception: " + e.Message);
  139. }
  140. }
  141.  
  142. // OnVote
  143. public override bool OnVote(String Vote, ServerClient Client, String OptionalArg)
  144. {
  145. try
  146. {
  147. // If the vote caller is not an admin
  148. if (!Admins.Contains(Client.XUID))
  149. {
  150. // If the player is not allowed to vote
  151. if (this.Players_No_Vote.Contains(Client.XUID))
  152. {
  153. // The player is no more allowed to vote
  154. TellClient(Client.ClientNum, "You can not vote on this server!!!", true);
  155. return false;
  156. }
  157. else
  158. {
  159. if (DateTime.Now.Subtract(this.Players_Last_Vote[Client.ClientNum]).TotalSeconds < this.Vote_Interval)
  160. {
  161. // Interval not Ok, vote not allowed
  162. this.Players_Spam_Vote_Ticks[Client.ClientNum] += 1;
  163. if (this.Players_Spam_Vote_Ticks[Client.ClientNum] == Warns_Nbr)
  164. {
  165. // reached the max warn number => vote-ban player
  166. Players_No_Vote.Add(Client.XUID);
  167. // Tell to the client that he has been vote-banned
  168. TellClient(Client.ClientNum, this.Ban_Message, true);
  169. }
  170. else
  171. {
  172. // Warn the player
  173. String Vote_Warn_Message2 = this.Warn_Message;
  174. Vote_Warn_Message2.Replace("@WARN_LEFT@", "" + (Warns_Nbr - this.Players_Spam_Vote_Ticks[Client.ClientNum]));
  175. Vote_Warn_Message2.Replace("@VOTE_INTERVAL@", "" + this.Vote_Interval);
  176. TellClient(Client.ClientNum, Vote_Warn_Message2, true);
  177. }
  178.  
  179. return false;
  180. }
  181. else
  182. {
  183. // Reset the player spam ticks
  184. this.Players_Spam_Vote_Ticks[Client.ClientNum] = 0;
  185.  
  186. // Set Players_Last_Vote[Client.ClientNum] to the current time
  187. this.Players_Last_Vote[Client.ClientNum] = DateTime.Now;
  188.  
  189. // If the vote is for kicking
  190. if (Vote == "kick")
  191. {
  192. // Get the clients list
  193. List<ServerClient> Clients = GetClients();
  194.  
  195. // If not null
  196. if (Clients != null)
  197. {
  198. // Loop the clients list
  199. foreach (ServerClient player in Clients)
  200. {
  201. // If the current player is the player to kick
  202. if (player.Name == OptionalArg)
  203. {
  204. // Check if the player to kick is an admin
  205. if (this.Admins.Contains(player.XUID))
  206. {
  207. // Ohoh try to kick an admin ahah!!
  208. this.Players_Spam_Vote_Ticks[Client.ClientNum] += 1;
  209. if (this.Players_Spam_Vote_Ticks[Client.ClientNum] == Warns_Nbr)
  210. {
  211. // reached the max warn number => vote-ban player
  212. Players_No_Vote.Add(Client.XUID);
  213. // Tell to the client that he has been vote-banned
  214. TellClient(Client.ClientNum, this.Ban_Message, true);
  215. }
  216. else
  217. {
  218. // Warn the player that trying to vote-kick an admin is stupid lol
  219. String Vote_Admin_Kick_Message = this.Try_Admin_Kick_Message;
  220. Vote_Admin_Kick_Message.Replace("@WARN_LEFT@", "" + (Warns_Nbr - this.Players_Spam_Vote_Ticks[Client.ClientNum]));
  221. Vote_Admin_Kick_Message.Replace("@VOTE_INTERVAL@", "" + this.Vote_Interval);
  222. TellClient(Client.ClientNum, Vote_Admin_Kick_Message, true);
  223. }
  224. return false;
  225. }
  226.  
  227. if (this.Immunized_Xuids.Contains(player.XUID))
  228. {
  229. // Ohoh try to kick an immunized player ahah!!
  230. this.Players_Spam_Vote_Ticks[Client.ClientNum] += 1;
  231. if (this.Players_Spam_Vote_Ticks[Client.ClientNum] == Warns_Nbr)
  232. {
  233. // reached the max warn number => vote-ban player
  234. Players_No_Vote.Add(Client.XUID);
  235. // Tell to the client that he has been vote-banned
  236. TellClient(Client.ClientNum, this.Ban_Message, true);
  237. }
  238. else
  239. {
  240. // Warn the player that trying to vote-kick an immunized player is not allowed
  241. String Try_Immunized_Kick_Message2 = this.Try_Immunized_Kick_Message;
  242. Try_Immunized_Kick_Message2.Replace("@WARN_LEFT@", "" + (Warns_Nbr - this.Players_Spam_Vote_Ticks[Client.ClientNum]));
  243. Try_Immunized_Kick_Message2.Replace("@VOTE_INTERVAL@", "" + this.Vote_Interval);
  244. Try_Immunized_Kick_Message2.Replace("@PLAYER_NAME@", player.Name);
  245. TellClient(Client.ClientNum, Try_Immunized_Kick_Message2, true);
  246. }
  247. return false;
  248. }
  249. }
  250. }
  251. }
  252. }
  253. }
  254. }
  255. }
  256.  
  257. return true;
  258. }
  259. catch (Exception e)
  260. {
  261. ServerPrint("Plugin AntiVoteAbuse: OnVote catched exception: " + e.Message);
  262. // Error so let the vote happend
  263. return true;
  264. }
  265. }
  266.  
  267. public override ChatType OnSay(string Message, ServerClient Client, bool Teamchat)
  268. {
  269. // If the message starts with !vi
  270. if (Message.StartsWith("!vi"))
  271. {
  272. // Split the message by spaces
  273. string[] message_words = Message.Split(' ');
  274. // If there is more than 1 word
  275. if (message_words.Length > 1)
  276. {
  277. // Get the clients list
  278. List<ServerClient> Clients = GetClients();
  279. string player_to_found = Message.Substring(4);
  280. // If not null
  281. if (Clients != null)
  282. {
  283. // Loop the clients list
  284. foreach (ServerClient player in Clients)
  285. {
  286. if (player.Name == player_to_found)
  287. {
  288. if (this.Immunized_Xuids.Contains(player.XUID))
  289. {
  290. TellClient(Client.ClientNum, "This player is already immunized!", true);
  291. }
  292. else
  293. {
  294. // Add the player to the immunized list
  295. this.Immunized_Xuids.Add(player.XUID);
  296. // Save the player in the servercfg
  297. SetServerCFG("AntiVoteAbuse", "Immunized_Xuids", GetServerCFG("AntiVoteAbuse", "Immunized_Xuids", "") + "," + player.XUID);
  298. return ChatType.ChatNone;
  299. }
  300. }
  301. }
  302. }
  303.  
  304. TellClient(Client.ClientNum, "Impossible to found the player to immunize!", true);
  305.  
  306. }
  307. }
  308. return ChatType.ChatContinue;
  309. }
  310. }
  311. }


Attached Files
.zip   AntiVoteAbuse.zip (Size: 3.82 KB / Downloads: 10)
Reply

#28
This feature is important.
Vote_Kick_Only=0
// 0 = only votekick affected, 1 = all the vote types
You can disable "next map" and "map vote"?

thanks
[Image: b_560_95_1.png]
Reply

#29
Hello,

You have this setting "Vote_Kick_Only=0" because i forget to take it out when i posted the last message.
I edited the post just after you took it... ;(
When i posted the message this part was not done in the code ( lol ).

I added it yesterday but i haven't released yet, i'll release it tonight or as soon as possible.

You want the "next map" and "map vote" disabled in the menu? Sorry i can't do this.
I only can block this vote when called.

(The "Vote_Kick_Only=0" is to know for what type of vote you want the antivoteabuse to warn/vote-ban players.
0 = all type of vote are controled by the plugin, 1 = only the vote-kick is controled)
Reply

#30
(09-11-2012, 10:31)narkos Wrote: I added it yesterday but i haven't released yet, i'll release it tonight or as soon as possible.

You want the "next map" and "map vote" disabled in the menu? Sorry i can't do this.
I only can block this vote when called.

Perfect!!Big Grin
[Image: b_560_95_1.png]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Release] iSnipe anti hardscope mutant 0 3,285 11-06-2013, 11:27
Last Post: mutant
  Need An Anti Hack Manuadminmod worldclass 2 3,538 10-14-2013, 09:57
Last Post: d0h!
  [Request] Request for Assistance with Modding COD: BO using Mod Tools one1lion 9 6,207 09-17-2013, 21:04
Last Post: one1lion
  [Request] Airdrop Heaven mod The_Reaper_1 0 2,337 09-10-2013, 14:13
Last Post: The_Reaper_1
  [Request] Request for !afk and !balance plugins. UlTiiMaTuM 3 3,295 09-10-2013, 02:13
Last Post: UlTiiMaTuM
  Searching for Anti HS ExoGamer* 10 6,235 08-08-2013, 12:39
Last Post: aceed
  [REQUEST] Antinoob mod sleepunknot 3 2,904 05-15-2013, 20:10
Last Post: sleepunknot
  [Release] Anti-Invisible Name master131 24 20,221 05-02-2013, 14:15
Last Post: .sepultura.
  Moab and server request CHRISLUVMSR 6 4,351 04-17-2013, 18:28
Last Post: X-Track
  [Request] Teknogods Expert's Classes 1.5 request The6thMessenger 0 2,303 04-13-2013, 08:22
Last Post: The6thMessenger

Forum Jump:


Users browsing this thread:
2 Guest(s)

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