Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. #pragma semicolon 1
  2.  
  3. #include <amxmodx>
  4. #include <hamsandwich>
  5. #include <reapi>
  6.  
  7. #define ATYPE_BOOL AType:6
  8.  
  9. enum _:Hook {
  10. HookChain:HookHasRestrictItem,
  11. HookChain:HookDropPlayerItem,
  12. HookChain:HookDeadPlayerWeapons,
  13. HookChain:HookDeadGiveC4,
  14. };
  15. new Hooks[Hook];
  16.  
  17. new bool:Started = false;
  18.  
  19. public plugin_init() {
  20. register_plugin("[REGG] Block default behavior", "0.1", "F@nt0M");
  21.  
  22. Hooks[HookHasRestrictItem] = RegisterHookChain(RG_CBasePlayer_HasRestrictItem, "CBasePlayer_HasRestrictItem_Pre", false);
  23. Hooks[HookDropPlayerItem] = RegisterHookChain(RG_CBasePlayer_DropPlayerItem, "CBasePlayer_DropPlayerItem_Pre", false);
  24. Hooks[HookDeadPlayerWeapons] = RegisterHookChain(RG_CSGameRules_DeadPlayerWeapons, "CSGameRules_DeadPlayerWeapons_Pre", false);
  25. Hooks[HookDeadGiveC4] = RegisterHookChain(RG_CSGameRules_GiveC4, "CSGameRules_GiveC4_Pre", false);
  26.  
  27. finish();
  28. }
  29.  
  30. public plugin_natives() {
  31. register_native("ReGG_Start", "NativeStart", 0);
  32. register_native("ReGG_Finish", "NativeFinish", 0);
  33. }
  34.  
  35. public ReGG_Started() {
  36. start();
  37. }
  38.  
  39. public ReGG_Finished() {
  40. finish();
  41. }
  42.  
  43. public CBasePlayer_HasRestrictItem_Pre() {
  44. SetHookChainReturn(ATYPE_BOOL, true);
  45. return HC_SUPERCEDE;
  46. }
  47.  
  48. public CBasePlayer_DropPlayerItem_Pre() {
  49. SetHookChainReturn(ATYPE_INTEGER, 0);
  50. return HC_SUPERCEDE;
  51. }
  52.  
  53. public CSGameRules_DeadPlayerWeapons_Pre() {
  54. SetHookChainReturn(ATYPE_INTEGER, GR_PLR_DROP_GUN_NO);
  55. }
  56.  
  57. public CSGameRules_GiveC4_Pre() {
  58. return HC_SUPERCEDE;
  59. }
  60.  
  61. public bool:NativeStart(plugin, argc) {
  62. return start();
  63. }
  64.  
  65. public bool:NativeFinish(plugin, argc) {
  66. return finish();
  67. }
  68.  
  69. bool:start() {
  70. if (Started) {
  71. return false;
  72. }
  73.  
  74. EnableHookChain(Hooks[HookHasRestrictItem]);
  75. EnableHookChain(Hooks[HookDropPlayerItem]);
  76. EnableHookChain(Hooks[HookDeadPlayerWeapons]);
  77. EnableHookChain(Hooks[HookDeadGiveC4]);
  78.  
  79. Started = true;
  80. return true;
  81. }
  82.  
  83. bool:finish() {
  84. if (!Started) {
  85. return false;
  86. }
  87.  
  88. DisableHookChain(Hooks[HookHasRestrictItem]);
  89. DisableHookChain(Hooks[HookDropPlayerItem]);
  90. DisableHookChain(Hooks[HookDeadPlayerWeapons]);
  91. DisableHookChain(Hooks[HookDeadGiveC4]);
  92.  
  93. Started = false;
  94. return true;
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement