AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   hook ham_ after supercede (https://forums.alliedmods.net/showthread.php?t=278885)

JusTGo 02-10-2016 05:32

hook ham_ after supercede
 
so i have plugin #1:
PHP Code:

#include <hamsandwich>
#include <amxmodx>

public plugin_init()
{
    
RegisterHam(Ham_TakeDamage"player""TakeDamage_Pre");
}

public 
TakeDamage_Pre(iVictimiInflictoriAttackerFloat:fDamageiBitDamage)
{
    
HAM_SUPERCEDE


then in plugin #2 i want to hook take damage but i can't how to still be able to hook the forward while i supercede it.

Arkshine 02-10-2016 06:21

Re: hook ham_ after supercede
 
It should. The logic is to execute all registered forwards and will block original function if one of plugins supercede.

siriusmd99 02-10-2016 07:21

Re: hook ham_ after supercede
 
put plugin2 before plugin1 in plugins.ini

JusTGo 02-10-2016 07:24

Re: hook ham_ after supercede
 
i see my problems was i was using this:
PHP Code:

#include <amxmodx>
#include <hamsandwich> 

public plugin_init() 

    
RegisterHam(Ham_TraceAttack"player""TraceAttack_Pre"); 
    
RegisterHam(Ham_TakeDamage"player""TakeDamage_Pre"); 


public 
TakeDamage_Pre(iVictimiInflictoriAttackerFloat:fDamageiBitDamage

    return 
HAM_SUPERCEDE 
}

public 
TraceAttack_Pre()
{
    return 
HAM_SUPERCEDE


and takedamage wasn't called but trace attack is working so i will just use it:
PHP Code:

#include <amxmodx> 
#include <hamsandwich> 


public plugin_init() 

    
RegisterHam(Ham_TraceAttack"player""TraceAttack_Pre"); 
    
RegisterHam(Ham_TakeDamage"player""TakeDamage_Pre"); 


public 
TakeDamage_Pre(iVictimiInflictoriAttackerFloat:fDamageiBitDamage

    
client_print(0,print_chat,"called?")


public 
TraceAttack_Pre()
{
    
client_print(0,print_chat,"called2?")



klippy 02-10-2016 08:16

Re: hook ham_ after supercede
 
TakeDamage hook wasn't called because TakeDamage is never getting called in the game dll. The reason is that TakeDamage is called from TraceAttack, and you blocked TraceAttack from being called.

JusTGo 02-10-2016 09:58

Re: hook ham_ after supercede
 
Quote:

Originally Posted by KliPPy (Post 2391706)
TakeDamage hook wasn't called because TakeDamage is never getting called in the game dll. The reason is that TakeDamage is called from TraceAttack, and you blocked TraceAttack from being called.

ty for explaining but already discovered that :wink:


All times are GMT -4. The time now is 09:26.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.