Raised This Month: $51 Target: $400
 12% 

whats the different of ExecuteHam and ExecuteHamB


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xfire
Member
Join Date: Apr 2010
Location: World
Old 01-24-2012 , 16:46   whats the different of ExecuteHam and ExecuteHamB
Reply With Quote #1

whats the different of ExecuteHam and ExecuteHamB?
__________________
.
xfire is offline
Send a message via MSN to xfire Send a message via Skype™ to xfire
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 01-24-2012 , 17:04   Re: whats the different of ExecuteHam and ExecuteHamB
Reply With Quote #2

They both execute the virtual function on the entity, but ExecuteHamB will trigger all the hooks that has been made on the virtual function.

Example:

Let say you have a takedamage hook in a plugin that just prints the damage output to everyone:
Code:
RegisterHam( Ham_TakeDamage, "player", "Forward_Ham_TakeDamage_Pre" ); public Forward_Ham_TakeDamage_Pre( Client, Inflictor, Attacker, Float:Damage, Damagebits ) {     client_print( 0, print_chat, "[debug] damage: %.1f", Damage );     // will print damage each time damage is taken } ExecuteHam( Ham_TakeDamage, client, inflictor, attacker, damage, damagebits ); // if I were to execute the above line it would just deal the exact damage that was assigned // whereas this: ExecuteHamB( Ham_TakeDamage, client, inflictor, attacker, damage, damagebits ); // would do the same thing, but will go through the hook as well - so you can actually reduce, increase or block the incoming damage

Note that when using ExecuteHamB it's not just within your plugin that the damage can be mitigated or changed - it gets called in all loaded plugins (where the hook is active).

EDIT: Take a look at the .inc files located in your scripting/includes folder. Most of the functions have descriptions.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!

Last edited by Xellath; 01-24-2012 at 17:08.
Xellath is offline
xfire
Member
Join Date: Apr 2010
Location: World
Old 01-24-2012 , 17:17   Re: whats the different of ExecuteHam and ExecuteHamB
Reply With Quote #3

Quote:
Originally Posted by Xellath View Post
They both execute the virtual function on the entity, but ExecuteHamB will trigger all the hooks that has been made on the virtual function.

Example:

Let say you have a takedamage hook in a plugin that just prints the damage output to everyone:
Code:
RegisterHam( Ham_TakeDamage, "player", "Forward_Ham_TakeDamage_Pre" ); public Forward_Ham_TakeDamage_Pre( Client, Inflictor, Attacker, Float:Damage, Damagebits ) {     client_print( 0, print_chat, "[debug] damage: %.1f", Damage );     // will print damage each time damage is taken } ExecuteHam( Ham_TakeDamage, client, inflictor, attacker, damage, damagebits ); // if I were to execute the above line it would just deal the exact damage that was assigned // whereas this: ExecuteHamB( Ham_TakeDamage, client, inflictor, attacker, damage, damagebits ); // would do the same thing, but will go through the hook as well - so you can actually reduce, increase or block the incoming damage

Note that when using ExecuteHamB it's not just within your plugin that the damage can be mitigated or changed - it gets called in all loaded plugins (where the hook is active).

EDIT: Take a look at the .inc files located in your scripting/includes folder. Most of the functions have descriptions.
thanks, it helped
__________________
.
xfire is offline
Send a message via MSN to xfire Send a message via Skype™ to xfire
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 00:41.


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