AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Doubt about ham take damage (Ham_TakeDamage) (https://forums.alliedmods.net/showthread.php?t=308299)

esenrik 06-15-2018 06:37

Doubt about ham take damage (Ham_TakeDamage)
 
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.

E1_531G 06-15-2018 07:37

Re: Doubt about ham take damage (Ham_TakeDamage)
 
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 06-15-2018 07:58

Re: Doubt about ham take damage (Ham_TakeDamage)
 
Can anyone confirm if is like this with ham takedamage?

Quote:

Originally Posted by E1_531G (Post 2597081)
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.


CrazY. 06-15-2018 08:28

Re: Doubt about ham take damage (Ham_TakeDamage)
 
Test with yourself. Just change the position of the plugins in plugins.ini and check what occurs.

Ghosted 06-16-2018 03:23

Re: Doubt about ham take damage (Ham_TakeDamage)
 
Last one from plugins.ini will be called first (if both are called in same forward i.e. plugin_init)

OciXCrom 06-16-2018 07:53

Re: Doubt about ham take damage (Ham_TakeDamage)
 
Quote:

Originally Posted by Ghosted (Post 2597227)
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.

Natsheh 06-16-2018 08:43

Re: Doubt about ham take damage (Ham_TakeDamage)
 
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.

Ghosted 06-16-2018 10:39

Re: Doubt about ham take damage (Ham_TakeDamage)
 
Quote:

Originally Posted by OciXCrom (Post 2597239)
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.

OciXCrom 06-16-2018 11:59

Re: Doubt about ham take damage (Ham_TakeDamage)
 
Yeah, this case is different because he isn't "blocking" the forward. The final damage will be 500.

Ghosted 06-16-2018 12:01

Re: Doubt about ham take damage (Ham_TakeDamage)
 
Quote:

Originally Posted by OciXCrom (Post 2597270)
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.


All times are GMT -4. The time now is 04:38.

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