• 7 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Release] NoKnife Plugin
#1
This Plugin should disable Knife damage.

Requirements:
@Nukem's dedicated server addon
MW3 Dedicated Server

This plugin uses signature scans to find the offsets, it *should* work on all MW3 versions.

Commands:
!knife - Show if knifing enabled/disabled
!knife 0 - Disable knifing
!knife 1 - Enable knifing

sv_config:
Code:
[Knife]
Enabled=1
// 0 or 1
ChatCommands=1
// 0 or 1, enable/disable chat commands above

Obsolete source code
CSHARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Addon;
  5.  
  6. namespace NoKnife
  7. {
  8. public class Class1 : CPlugin
  9. {
  10. [System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true)]
  11. private static extern bool WriteProcessMemory(IntPtr hProcess, int lpBaseAddress, byte[] lpBuffer, int nSize, out int lpNumberOfBytesWritten);
  12.  
  13. string str_Knife = "enabled";
  14.  
  15. public override void OnServerLoad()
  16. {
  17. ServerPrint("\n NoKnife Plugin loaded \n Author: zxz0O0 \n Thanks to Nukem, Jariz, Pozzuh and Makavel\n");
  18. ServerPrint(" youtube.com/zxz0O0 \n itsmods.com\n");
  19.  
  20. if (GetServerCFG("Knife", "Enabled", "1") == "0")
  21. Knife(false);
  22. }
  23.  
  24. private void Knife(bool bl)
  25. {
  26. if (bl == false)
  27. {
  28. int oP;
  29. byte[] bytes = { 0xD9, 0x05, 0xD8, 0xFC, 0x76, 0x00 };
  30. WriteProcessMemory(((IntPtr)(-1)), 0x004B75E0, bytes, bytes.Length, out oP);
  31. str_Knife = "disabled";
  32. ServerSay("Knifing disabled", false);
  33. }
  34. else
  35. {
  36. int oP;
  37. byte[] bytes = { 0xD9, 0x05, 0xD0, 0x5A, 0x78, 0x00 };
  38. WriteProcessMemory(((IntPtr)(-1)), 0x004B75E0, bytes, bytes.Length, out oP);
  39. str_Knife = "enabled";
  40. ServerSay("Knifing enabled", false);
  41. }
  42. }
  43.  
  44. public override ChatType OnSay(string Message, ServerClient Client)
  45. {
  46. if (Message == "!knife")
  47. {
  48. TellClient(Client.ClientNum, "PM: Knifing " + str_Knife, true);
  49. return ChatType.ChatNone;
  50. }
  51. else if (Message.StartsWith("!knife "))
  52. {
  53. if (Message == "!knife 0")
  54. Knife(false);
  55. else if (Message == "!knife 1")
  56. Knife(true);
  57.  
  58. return ChatType.ChatNone;
  59. }
  60. return ChatType.ChatContinue;
  61. }
  62. }
  63. }


Thanks to @makavel for testing and helping and thanks to @Nukem for telling how to fix the bugs.


Attached Files
.zip   NoKnife.zip (Size: 3.69 KB / Downloads: 1,603)
[Image: azuw.jpg]
  Reply
#2
Why did you set it to 11 and not to 1 or 0?
[Image: MaEIQ.png]
  Reply
#3
(03-03-2012, 10:47)Pozzuh Wrote: Why did you set it to 11 and not to 1 or 0?

If you set it to 0 you are immune to weapons too. If you set it 0 < x < 10 hitboxes are weird. Not sure what causes that, but I tried the highest possible value where you can not knife and 11 should be ok.
[Image: azuw.jpg]
  Reply
#4
So what dvar is that?
[Image: MaEIQ.png]
  Reply
#5
(03-03-2012, 11:06)Pozzuh Wrote: So what dvar is that?

player_MeleeRange obviously.
[Image: azuw.jpg]
  Reply
#6
How would setting that to 0 make all players invincible? That didn't happen in any cod.
[Image: MaEIQ.png]
  Reply
#7
(03-03-2012, 11:12)Pozzuh Wrote: How would setting that to 0 make all players invincible? That didn't happen in any cod.

As you can see it's a float address and of course other dvars are also using that float dvar.
[Image: azuw.jpg]
  Reply
#8
good one +rep
  Reply
#9
(03-03-2012, 11:25)zxz0O0 Wrote:
(03-03-2012, 11:12)Pozzuh Wrote: How would setting that to 0 make all players invincible? That didn't happen in any cod.

As you can see it's a float address and of course other dvars are also using that float dvar.

Well he`s right. It changes some others dvar value also so that effect to other dvar`s aswell which are also associated with the same float value.
  Reply
#10
Thanks for adding me to the credits. Awesome plugin.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Wink Plugin with !ban !kick and !tampban clemi555 3 3,884 11-09-2013, 09:21
Last Post: clemi555
  AntiNoScope Plugin clemi555 5 4,337 11-08-2013, 19:13
Last Post: clemi555
  [Release] Bunker Plugin 1.3 archit 68 38,152 10-30-2013, 11:59
Last Post: clacki
  Help Modifying plugin maverigh 5 5,245 10-19-2013, 10:29
Last Post: Nekochan
Shocked [Request] Switch plugin axel-le-meilleur 6 4,602 10-19-2013, 06:59
Last Post: iRoNinja
  [Release] Yurio Map Plugin Yurio 101 57,432 09-26-2013, 13:38
Last Post: First_Semyon
Brick [Release] v1.1 ChangeMap/NextMap Plugin without any configuration milchshake 23 17,340 09-23-2013, 13:18
Last Post: SgtLegend
  Help !say Plugin (like the !say from GodPlugin) Hallla 0 2,524 09-13-2013, 09:31
Last Post: Hallla
Rainbow [Release] MW3: Random Weapon Plugin V1 Nekochan 50 30,298 09-11-2013, 15:11
Last Post: EnVi Sweden Rocks
  Search Plugin Fluid Killcam N3xT_974 1 2,839 09-10-2013, 20:27
Last Post: Nekochan

Forum Jump:


Users browsing this thread: 1 Guest(s)