Raised This Month: $32 Target: $400
 8% 

hook ham_ after supercede


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JusTGo
Veteran Member
Join Date: Mar 2013
Old 02-10-2016 , 05:32   hook ham_ after supercede
Reply With Quote #1

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.
__________________
JusTGo is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-10-2016 , 06:21   Re: hook ham_ after supercede
Reply With Quote #2

It should. The logic is to execute all registered forwards and will block original function if one of plugins supercede.
__________________
Arkshine is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 02-10-2016 , 07:21   Re: hook ham_ after supercede
Reply With Quote #3

put plugin2 before plugin1 in plugins.ini
siriusmd99 is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 02-10-2016 , 07:24   Re: hook ham_ after supercede
Reply With Quote #4

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?")

__________________
JusTGo is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-10-2016 , 08:16   Re: hook ham_ after supercede
Reply With Quote #5

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.
klippy is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 02-10-2016 , 09:58   Re: hook ham_ after supercede
Reply With Quote #6

Quote:
Originally Posted by KliPPy View Post
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
__________________
JusTGo is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:52.


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