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:
Obsolete source code
Thanks to @makavel for testing and helping and thanks to @Nukem for telling how to fix the bugs.
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
- using System;
- using System.Collections.Generic;
- using System.Text;
- using Addon;
-
- namespace NoKnife
- {
- public class Class1 : CPlugin
- {
- [System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true)]
- private static extern bool WriteProcessMemory(IntPtr hProcess, int lpBaseAddress, byte[] lpBuffer, int nSize, out int lpNumberOfBytesWritten);
-
- string str_Knife = "enabled";
-
- public override void OnServerLoad()
- {
- ServerPrint("\n NoKnife Plugin loaded \n Author: zxz0O0 \n Thanks to Nukem, Jariz, Pozzuh and Makavel\n");
- ServerPrint(" youtube.com/zxz0O0 \n itsmods.com\n");
-
- if (GetServerCFG("Knife", "Enabled", "1") == "0")
- Knife(false);
- }
-
- private void Knife(bool bl)
- {
- if (bl == false)
- {
- int oP;
- byte[] bytes = { 0xD9, 0x05, 0xD8, 0xFC, 0x76, 0x00 };
- WriteProcessMemory(((IntPtr)(-1)), 0x004B75E0, bytes, bytes.Length, out oP);
- str_Knife = "disabled";
- ServerSay("Knifing disabled", false);
- }
- else
- {
- int oP;
- byte[] bytes = { 0xD9, 0x05, 0xD0, 0x5A, 0x78, 0x00 };
- WriteProcessMemory(((IntPtr)(-1)), 0x004B75E0, bytes, bytes.Length, out oP);
- str_Knife = "enabled";
- ServerSay("Knifing enabled", false);
- }
- }
-
- public override ChatType OnSay(string Message, ServerClient Client)
- {
- if (Message == "!knife")
- {
- TellClient(Client.ClientNum, "PM: Knifing " + str_Knife, true);
- return ChatType.ChatNone;
- }
- else if (Message.StartsWith("!knife "))
- {
- if (Message == "!knife 0")
- Knife(false);
- else if (Message == "!knife 1")
- Knife(true);
-
- return ChatType.ChatNone;
- }
- return ChatType.ChatContinue;
- }
- }
- }
Thanks to @makavel for testing and helping and thanks to @Nukem for telling how to fix the bugs.