Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #include <amxmodx>
- #include <hamsandwich>
- #include <reapi>
- #define ATYPE_BOOL AType:6
- enum _:Hook {
- HookChain:HookHasRestrictItem,
- HookChain:HookDropPlayerItem,
- HookChain:HookDeadPlayerWeapons,
- HookChain:HookDeadGiveC4,
- };
- new Hooks[Hook];
- new bool:Started = false;
- public plugin_init() {
- register_plugin("[REGG] Block default behavior", "0.1", "F@nt0M");
- Hooks[HookHasRestrictItem] = RegisterHookChain(RG_CBasePlayer_HasRestrictItem, "CBasePlayer_HasRestrictItem_Pre", false);
- Hooks[HookDropPlayerItem] = RegisterHookChain(RG_CBasePlayer_DropPlayerItem, "CBasePlayer_DropPlayerItem_Pre", false);
- Hooks[HookDeadPlayerWeapons] = RegisterHookChain(RG_CSGameRules_DeadPlayerWeapons, "CSGameRules_DeadPlayerWeapons_Pre", false);
- Hooks[HookDeadGiveC4] = RegisterHookChain(RG_CSGameRules_GiveC4, "CSGameRules_GiveC4_Pre", false);
- finish();
- }
- public plugin_natives() {
- register_native("ReGG_Start", "NativeStart", 0);
- register_native("ReGG_Finish", "NativeFinish", 0);
- }
- public ReGG_Started() {
- start();
- }
- public ReGG_Finished() {
- finish();
- }
- public CBasePlayer_HasRestrictItem_Pre() {
- SetHookChainReturn(ATYPE_BOOL, true);
- return HC_SUPERCEDE;
- }
- public CBasePlayer_DropPlayerItem_Pre() {
- SetHookChainReturn(ATYPE_INTEGER, 0);
- return HC_SUPERCEDE;
- }
- public CSGameRules_DeadPlayerWeapons_Pre() {
- SetHookChainReturn(ATYPE_INTEGER, GR_PLR_DROP_GUN_NO);
- }
- public CSGameRules_GiveC4_Pre() {
- return HC_SUPERCEDE;
- }
- public bool:NativeStart(plugin, argc) {
- return start();
- }
- public bool:NativeFinish(plugin, argc) {
- return finish();
- }
- bool:start() {
- if (Started) {
- return false;
- }
- EnableHookChain(Hooks[HookHasRestrictItem]);
- EnableHookChain(Hooks[HookDropPlayerItem]);
- EnableHookChain(Hooks[HookDeadPlayerWeapons]);
- EnableHookChain(Hooks[HookDeadGiveC4]);
- Started = true;
- return true;
- }
- bool:finish() {
- if (!Started) {
- return false;
- }
- DisableHookChain(Hooks[HookHasRestrictItem]);
- DisableHookChain(Hooks[HookDropPlayerItem]);
- DisableHookChain(Hooks[HookDeadPlayerWeapons]);
- DisableHookChain(Hooks[HookDeadGiveC4]);
- Started = false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement