ItsMods
[Release] NoKnife Plugin - Printable Version

+- ItsMods (https://www.itsmods.com)
+-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html)
+--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html)
+--- Thread: [Release] NoKnife Plugin (/Thread-Release-NoKnife-Plugin.html)

Pages: 1 2 3 4 5 6 7 8 9


NoKnife Plugin - zxz0O0 - 03-03-2012

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
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.


RE: NoKnife Plugin Beta - Pozzuh - 03-03-2012

Why did you set it to 11 and not to 1 or 0?


RE: NoKnife Plugin Beta - zxz0O0 - 03-03-2012

(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.


RE: NoKnife Plugin Beta - Pozzuh - 03-03-2012

So what dvar is that?


RE: NoKnife Plugin Beta - zxz0O0 - 03-03-2012

(03-03-2012, 11:06)Pozzuh Wrote: So what dvar is that?

player_MeleeRange obviously.


RE: NoKnife Plugin Beta - Pozzuh - 03-03-2012

How would setting that to 0 make all players invincible? That didn't happen in any cod.


RE: NoKnife Plugin Beta - zxz0O0 - 03-03-2012

(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.


RE: NoKnife Plugin Beta - d0h! - 03-03-2012

good one +rep


RE: NoKnife Plugin Beta - yamraj - 03-03-2012

(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.


RE: NoKnife Plugin Beta - JariZ - 03-03-2012

Thanks for adding me to the credits. Awesome plugin.