Post Reply 
 
Thread Rating:
  • 7 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release NoKnife Plugin
03-03-2012, 10:38 (This post was last modified: 07-03-2012 18:03 by zxz0O0.)
Post: #1
NoKnife Plugin
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.
Related links


Attached File(s)
.zip  NoKnife.zip (Size: 3.69 KB / Downloads: 1133)

[Image: azuw.jpg]
Find all posts by this user
Add Thank You Quote this message in a reply
[-] The following 13 users say Thank You to zxz0O0 for this post:
aaaaim (03-19-2012), blueberry9 (03-03-2012), bonemind (03-03-2012), Canta (06-27-2012), choppson (03-06-2012), d0h! (03-03-2012), Diskretor (05-14-2013), G-Man (04-19-2012), itsmods.com76 (09-17-2012), jakata (04-20-2012), JariZ (03-03-2012), shanky (01-14-2013), xcondex (04-19-2012)
03-03-2012, 10:47
Post: #2
RE: NoKnife Plugin Beta
Why did you set it to 11 and not to 1 or 0?

[Image: MaEIQ.png]
Find all posts by this user
Add Thank You Quote this message in a reply
03-03-2012, 10:51
Post: #3
RE: NoKnife Plugin Beta
(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]
Find all posts by this user
Add Thank You Quote this message in a reply
03-03-2012, 11:06
Post: #4
RE: NoKnife Plugin Beta
So what dvar is that?
Related links

[Image: MaEIQ.png]
Find all posts by this user
Add Thank You Quote this message in a reply
03-03-2012, 11:11
Post: #5
RE: NoKnife Plugin Beta
(03-03-2012 11:06)Pozzuh Wrote:  So what dvar is that?

player_MeleeRange obviously.

[Image: azuw.jpg]
Find all posts by this user
Add Thank You Quote this message in a reply
03-03-2012, 11:12
Post: #6
RE: NoKnife Plugin Beta
How would setting that to 0 make all players invincible? That didn't happen in any cod.

[Image: MaEIQ.png]
Find all posts by this user
Add Thank You Quote this message in a reply
03-03-2012, 11:25
Post: #7
RE: NoKnife Plugin Beta
(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]
Find all posts by this user
Add Thank You Quote this message in a reply
03-03-2012, 12:29
Post: #8
RE: NoKnife Plugin Beta
good one +rep
Related links
Visit this user's website Find all posts by this user
Add Thank You Quote this message in a reply
03-03-2012, 12:57 (This post was last modified: 03-03-2012 15:16 by yamraj.)
Post: #9
RE: NoKnife Plugin Beta
(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.
Find all posts by this user
Add Thank You Quote this message in a reply
03-03-2012, 14:50
Post: #10
RE: NoKnife Plugin Beta
Thanks for adding me to the credits. Awesome plugin.

[Image: k5sVYyb.gif]
Visit this user's website Find all posts by this user
Add Thank You Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Release] Flag plugin for users 1.6 archit 73 4,691 Yesterday 17:07
Last Post: EnVi Sweden Rocks
  [Release] God Plugin v4.0 [Ingame Rcon Tool] OzonE 312 37,520 05-22-2013 20:21
Last Post: xaliu
  [Release] For Plugin Developers yamraj 4 1,211 05-21-2013 17:55
Last Post: Jone Calerone
  [Release] Chat plugin for permissions SgtLegend 8 309 05-21-2013 11:21
Last Post: SgtLegend
  [Release] Waypoint plugin for users 8q4s8 0 144 05-16-2013 13:10
Last Post: 8q4s8
  [Release] Bunker Plugin 1.3 archit 56 3,106 05-09-2013 14:13
Last Post: M4cbook
  [Release] Speed Plugin hillbilly 25 3,638 05-06-2013 18:19
Last Post: Hallla
  [Release] Votemap plugin zhp0083 82 11,418 04-12-2013 02:46
Last Post: .sepultura.
Brick [Release] Flag plugin for developers [Z00MBY] Alex 17 1,428 04-06-2013 17:52
Last Post: Dr3am95
Smile [Release] Map & Game Type Changer Plugin (Fixed) 30mba 30 2,775 04-05-2013 02:27
Last Post: BenderB

Forum Jump:


User(s) browsing this thread: 1 Guest(s)
Media Embeding by Simple Audio Video Embeder