Raised This Month: $ Target: $400
 0% 

ExecuteHam/b Information?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 02-13-2013 , 19:22   ExecuteHam/b Information?
Reply With Quote #1

I only need a bit more information from the ones who know the difference between ExecuteHam and ExecuteHamB.

I have this part of code:
PHP Code:
#include < amxmodx >
#include < hamsandwich >
#include < fakemeta >

public plugin_init( ) {
    
register_plugin"No Killer DeathMsg""1.0""n0br41ner" );
    
    
RegisterHam(Ham_Killed"player""Fwd_PlayerKilled_Pre"0);
}

public 
Fwd_PlayerKilled_Pre(victimattackershouldgib) {
    
ExecuteHam(Ham_Killedvictim0shouldgib);

    return 
HAM_SUPERCEDE;

And it works fine, but when i change the following:
PHP Code:
ExecuteHam(Ham_Killedvictim0shouldgib); 
->
PHP Code:
ExecuteHamB(Ham_Killedvictim0shouldgib); 
I get the following error:
Code:
L 02/14/2013 - 02:13:19: Start of error session.
L 02/14/2013 - 02:13:19: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20130214.log")
L 02/14/2013 - 02:13:19: [AMXX] Displaying debug trace (plugin "nodeathmsg.amxx")
L 02/14/2013 - 02:13:19: [AMXX] Run time error 3: stack error
Why am i asking? Because before i was using it with B and it was not working, i tried to use it without the B and it worked fine.
I had a similar problem here and it got fixed by using it without the B: http://forums.alliedmods.net/showthread.php?t=206474

Someone can explain what the situation is? I am just curious.
__________________

Last edited by n0br41ner; 02-13-2013 at 19:24.
n0br41ner is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-13-2013 , 19:26   Re: ExecuteHam/b Information?
Reply With Quote #2

B means function will be called for any plugins hooking this one.
__________________
Arkshine is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 02-13-2013 , 19:35   Re: ExecuteHam/b Information?
Reply With Quote #3

So you mean if there is another plugin hooking Ham_Killed (in this situation), the other plugin will hook it and if it didnt have the B, the other plugin will not be able to hook it?

That might be a problem to me, since i have another plugin that needs to hook the player's death.
Anyway i can fix this?
__________________
n0br41ner is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-13-2013 , 21:09   Re: ExecuteHam/b Information?
Reply With Quote #4

Read the documenation:

PHP Code:
/**
 * Executes the virtual function on the entity, this will trigger all hooks on that function.
 * Be very careful about recursion!
 * Look at the Ham enum for parameter lists.
 *
 * @param function        The function to call.
 * @param id            The id of the entity to execute it on.
 */
native ExecuteHamB(Ham:function, thisany:...); 
You need to use this one if you want that other plugin to hook the new death. However, as you have it, you will create an infinite loop (I think). You would need to make sure you check for things correctly before executing it.
__________________

Last edited by fysiks; 02-13-2013 at 21:11.
fysiks is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 02-13-2013 , 21:13   Re: ExecuteHam/b Information?
Reply With Quote #5

If you just need to change the attacker to 0, you should use SetHamParamInteger.

Also, you are receiving a stack error because you are calling Ham_Killed with ExecuteHamB (which sends to all plugins, including the one calling it) within the Ham_Killed hook, creating a giant loop.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 02-13-2013 , 22:27   Re: ExecuteHam/b Information?
Reply With Quote #6

Oh right i see now. How stupid of me, of course it will be an inifinite loop.
Thank you very much emp, that was exactly what i intended to do.

Thank you very much all of you.
__________________
n0br41ner is offline
Reply


Thread Tools
Display Modes

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 20:41.


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