AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Changing player's damage. (https://forums.alliedmods.net/showthread.php?t=224667)

Kz1.0 08-27-2013 00:54

Changing player's damage.
 
If I have 2 plugins, and first plugin set the damage to *2.0
PHP Code:

SetHamParamFloat(4damage*2.0

the second one I set to *3.0
PHP Code:

SetHamParamFloat(4damage*3.0

If the base damage is 100 so what the final damage will be ?

100*2*3 = 600 ? or 100*2.0 + 100*3.0 = 500 ??

~Ice*shOt 08-27-2013 05:36

Re: Changing player's damage.
 
there's no '+' in theses examples, I think it will be 100*2*3 = 600

ConnorMcLeod 08-27-2013 12:03

Re: Changing player's damage.
 
Either damage gonna be *2*3, so *6, either the last value gonna be used.

You should log in both plugins the damage input value, i guess it is the same in both plugins so only 1 change is applied.

President 08-27-2013 12:32

Re: Changing player's damage.
 
The damage may be 300 (if the 3x dmg plugin is the second) if you don't return HAM_SUPERCEDE in the first. But I'm not sure, why don't you just test?

Black Rose 08-27-2013 14:03

Re: Changing player's damage.
 
HAM_SUPERCEDE in either plugin will make it block damage completely. All the numbers will be correct but the actual health won't change.
In any other case the second plugin will receive what the first plugin sends. In this example the result would be 100*2*3 (600).
Yes, I tested it.

Code:
#include <amxmodx> #include <hamsandwich> public plugin_init() {     register_plugin("Plugin 1", "", "");     RegisterHam(Ham_TakeDamage, "player", "HookDamage"); } public HookDamage(victimID, inflictor, attackerID, Float:flDmg, dmgBits) {     server_print("Plugin 1: Original damage: %0.1f, new damage: %0.1f", flDmg, flDmg * 1.2);     SetHamParamFloat(4, flDmg * 1.2); }

Code:
#include <amxmodx> #include <hamsandwich> public plugin_init() {     register_plugin("Plugin 2", "", "");     RegisterHam(Ham_TakeDamage, "player", "HookDamage"); } public HookDamage(victimID, inflictor, attackerID, Float:flDmg, dmgBits) {     server_print("Plugin 2: Original damage: %0.1f, new damage: %0.1f", flDmg, flDmg * 1.3);     SetHamParamFloat(4, flDmg * 1.3); }

Code:

Plugin 1: Original damage: 16.8, new damage: 20.1
Plugin 2: Original damage: 20.1, new damage: 26.2

Damage applied: 26 according to health meter.

Kz1.0 08-27-2013 15:09

Re: Changing player's damage.
 
Thanks all :)

President 08-27-2013 16:36

Re: Changing player's damage.
 
Quote:

Originally Posted by Black Rose (Post 2022727)
HAM_SUPERCEDE in either plugin will make it block damage completely.

Lul?

Black Rose 08-27-2013 16:39

Re: Changing player's damage.
 
That is indeed very funny. I'm still laughing after writing it.
... ?


All times are GMT -4. The time now is 19:13.

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