Raised This Month: $ Target: $400
 0% 

Doubt about ham take damage (Ham_TakeDamage)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
esenrik
Senior Member
Join Date: Jul 2010
Old 06-15-2018 , 06:37   Doubt about ham take damage (Ham_TakeDamage)
Reply With Quote #1

Hello. The last days I'm asking myself something...

What's happens if I have multiple plugins with Ham_Takedamage and a SetHamParamFloat for damage in each?.

For example

Plugin 1 (just pseudocode for understanding):

Quote:
In Ham_Takedamage: SetHamParamFloat(4, 200)
return HAM_IGNORED;
Plugin 2 (just pseudocode for understanding):

Quote:
In Ham_Takedamage: SetHamParamFloat(4, 500)
return HAM_IGNORED;
Which will be the final damage that will receive the victim?? The plugin 1 damage or plugin 2 damage?

Thanks you.

Last edited by esenrik; 06-15-2018 at 06:37.
esenrik is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 06-15-2018 , 07:37   Re: Doubt about ham take damage (Ham_TakeDamage)
Reply With Quote #2

If it works like all other forwards and natives: the last param (from the last plugin in the list) will be returned to the engine.
Most precise they will override each other.
__________________
My English is A0

Last edited by E1_531G; 06-15-2018 at 07:38.
E1_531G is offline
esenrik
Senior Member
Join Date: Jul 2010
Old 06-15-2018 , 07:58   Re: Doubt about ham take damage (Ham_TakeDamage)
Reply With Quote #3

Can anyone confirm if is like this with ham takedamage?

Quote:
Originally Posted by E1_531G View Post
If it works like all other forwards and natives: the last param (from the last plugin in the list) will be returned to the engine.
Most precise they will override each other.
esenrik is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-15-2018 , 08:28   Re: Doubt about ham take damage (Ham_TakeDamage)
Reply With Quote #4

Test with yourself. Just change the position of the plugins in plugins.ini and check what occurs.
__________________









Last edited by CrazY.; 06-15-2018 at 08:28.
CrazY. is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 06-16-2018 , 03:23   Re: Doubt about ham take damage (Ham_TakeDamage)
Reply With Quote #5

Last one from plugins.ini will be called first (if both are called in same forward i.e. plugin_init)
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-16-2018 , 07:53   Re: Doubt about ham take damage (Ham_TakeDamage)
Reply With Quote #6

Quote:
Originally Posted by Ghosted View Post
Last one from plugins.ini will be called first (if both are called in same forward i.e. plugin_init)
Plugins on top have priority over the ones below them. If plugin A is on top of plugin B and it stops some function/forward, it won't be called in plugin B.
A good example for this is why we (or at least I do) always put gag plugins on top of plugins.ini, so they can block adminchat.amxx.
__________________

Last edited by OciXCrom; 06-16-2018 at 07:55.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-16-2018 , 08:43   Re: Doubt about ham take damage (Ham_TakeDamage)
Reply With Quote #7

In his situation the plugin on the bottom has more priority, because he is returning 0 in both functions.

The damage will be changed twice and the final value will be the plugin on bottom.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 06-16-2018 at 08:45.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 06-16-2018 , 10:39   Re: Doubt about ham take damage (Ham_TakeDamage)
Reply With Quote #8

Quote:
Originally Posted by OciXCrom View Post
Plugins on top have priority over the ones below them. If plugin A is on top of plugin B and it stops some function/forward, it won't be called in plugin B.
A good example for this is why we (or at least I do) always put gag plugins on top of plugins.ini, so they can block adminchat.amxx.
In this case u are wrong, cause hamsandwich replaces original function with yours and after registering first hook, calling struct will be something like this:
Function A => Original Function
and after 2nd hook it would be:
Function B => Function A => Original Function

(Cause function that will be replaced is Function A & not Orignal Function or something else).

Note: Function A is in Plugin A which is first in plugins.ini & Plugin B (Function B) is last one.
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM

Last edited by Ghosted; 06-16-2018 at 10:40.
Ghosted is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-16-2018 , 11:59   Re: Doubt about ham take damage (Ham_TakeDamage)
Reply With Quote #9

Yeah, this case is different because he isn't "blocking" the forward. The final damage will be 500.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 06-16-2018 , 12:01   Re: Doubt about ham take damage (Ham_TakeDamage)
Reply With Quote #10

Quote:
Originally Posted by OciXCrom View Post
Yeah, this case is different because he isn't "blocking" the forward. The final damage will be 500.
(lol srsly?)

The Damage will be 200.
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted 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 20:14.


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