ItsMods

Full Version: NoKnife Plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9
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.
Why did you set it to 11 and not to 1 or 0?
(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.
So what dvar is that?
(03-03-2012, 11:06)Pozzuh Wrote: [ -> ]So what dvar is that?

player_MeleeRange obviously.
How would setting that to 0 make all players invincible? That didn't happen in any cod.
(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.
good one +rep
(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.
Thanks for adding me to the credits. Awesome plugin.
Pages: 1 2 3 4 5 6 7 8 9