Thread Rating:
  • 3 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release AntiNameChanger
#1
As requested a plugin against name changers. It checks every 4-12 seconds if a player changed his name. When he did it a specific time an action will be taken.

Requires @Nukem's Server Addon 1.290+

sv_config.ini entries:
Code:
[NameChange]
//After how many name changes action should be taken
Changes=3
//Which action should be taken (kickClient, tempbanClient, banClient)
Command=kickClient
//Message to be displayed on server when an action is being taken, valid placeholder {0} = last name {1} = xuid
//Example: Player {0} with the XUID {1} has been kicked
ServerMsg=
//Reason for action (displayed to the client when action is being taken)
CommandMsg=

Source code
CSHARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Addon;
  5. using System.Threading;
  6.  
  7. namespace AntiNameChanger
  8. {
  9. public class Class1 : CPlugin
  10. {
  11. //Store old names
  12. Dictionary<string, string> OldNames = new Dictionary<string, string>();
  13. //Store name changes
  14. Dictionary<string, int> NameChanges = new Dictionary<string, int>();
  15. //How many changes to take action
  16. int Changes = 3;
  17. string command = "kickClient";
  18. string commandMsg = string.Empty;
  19. string srvMsg = string.Empty;
  20. public override void OnFastRestart()
  21. {
  22. OnMapChange();
  23. }
  24. public override void OnMapChange()
  25. {
  26. OldNames.Clear();
  27. NameChanges.Clear();
  28. }
  29. public override void OnServerLoad()
  30. {
  31. try
  32. {
  33. ServerPrint("\n AntiNameChanger loaded \n Author: zxz0O0 \n Thanks to Nukem, Jariz and Pozzuh\n");
  34. ServerPrint(" youtube.com/zxz0O0 \n itsmods.com\n");
  35.  
  36. Changes = int.Parse(GetServerCFG("NameChange", "Changes", "3"));
  37. command = GetServerCFG("NameChange", "Command", "kickClient");
  38. srvMsg = GetServerCFG("NameChange", "ServerMsg", string.Empty);
  39. ThreadPool.QueueUserWorkItem(new WaitCallback(CheckWorker));
  40. }
  41. catch (Exception e)
  42. {
  43. ServerPrint(e.Message);
  44. }
  45. }
  46.  
  47. private void CheckWorker(object o)
  48. {
  49. Random i = new Random();
  50. while (true)
  51. {
  52. int q = i.Next(0, 80);
  53. Thread.Sleep(4000 + q*100);
  54. CheckNames();
  55. }
  56. }
  57.  
  58. private void CheckNames()
  59. {
  60. try
  61. {
  62. foreach (ServerClient c in GetClients())
  63. {
  64. //If player is already registred
  65. if (OldNames.ContainsKey(c.XUID))
  66. {
  67. //If name didn't change
  68. if (OldNames[c.XUID] == c.Name)
  69. continue;
  70. //Else add to NameChanges int
  71. else
  72. {
  73. //If already stored increase value
  74. if (NameChanges.ContainsKey(c.XUID))
  75. NameChanges[c.XUID]++;
  76. else
  77. NameChanges.Add(c.XUID, 1);
  78. //Store new name again
  79. OldNames[c.XUID] = c.Name;
  80. //Check if action should be taken
  81. if (Changes <= NameChanges[c.XUID])
  82. {
  83. if (!string.IsNullOrEmpty(srvMsg))
  84. ServerSay(string.Format(srvMsg, c.Name, c.XUID), false);
  85.  
  86. ServerPrint("AntiNameChanger executed: " + command + " " + c.ClientNum + " \"" + commandMsg + "\"");
  87. ServerPrint("AntiNameChanger Last Name: " + c.Name);
  88. ServerCommand(command + " " + c.ClientNum + " \"" + commandMsg + "\"");
  89. }
  90. }
  91. }
  92. else
  93. OldNames.Add(c.XUID, c.Name);
  94. }
  95. }
  96. catch (Exception e)
  97. {
  98. ServerPrint(e.Message);
  99. }
  100. }
  101. }
  102. }


Attached Files
.zip   AntiNameChanger.zip (Size: 2.97 KB / Downloads: 627)
[Image: azuw.jpg]
Reply

#2
@SuperNovaAO mad
[Image: lQDUjba.jpg]
Reply

#3
(03-27-2012, 18:10)OrangePL Wrote: @SuperNovaAO mad

He said he would bypass this in a second. But this will work for the other 99%.

Noob hackers tommorow:
[Image: we-are-the-99-percent.png] [Image: success-kid-cut-out.png]
Reply

#4
(03-27-2012, 18:24)surtek Wrote:
(03-27-2012, 18:10)OrangePL Wrote: @SuperNovaAO mad

He said he would bypass this in a second. But this will work for the other 99%.
How can he bypass it when I use a random wait period Troll
[Image: azuw.jpg]
Reply

#5
(03-27-2012, 18:41)zxz0O0 Wrote:
(03-27-2012, 18:24)surtek Wrote:
(03-27-2012, 18:10)OrangePL Wrote: @SuperNovaAO mad

He said he would bypass this in a second. But this will work for the other 99%.
How can he bypass it when I use a random wait period Troll

He is @SuperNovaAO He can do whatever sh#t he wants to... Troll

Thanks Barata...
Don't worry if things aren't the way you planned, in the end everything will solve itself...
Reply

#6
He can make a hack which randomly guesses these periods Troll
Reply

#7
thankyou
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

Reply

#8
Weird that this hasn't been made before, good job!
(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

#9
nice +rep
Reply

#10
Random() is pseudo random and the seed the server starts with can be calculated.

Then I make a Random()-generator with the same seed -> same random numbers.

But my server crash exploit is much more fun now.
Also, have you tried it?
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Release] AntiNameChanger [Z00MBY] Alex 14 9,642 02-18-2013, 09:18
Last Post: JariZ

Forum Jump:


Users browsing this thread:
1 Guest(s)

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