Raised This Month: $ Target: $400
 0% 

Changing player's damage.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kz1.0
Senior Member
Join Date: Jan 2013
Location: Vietnam
Old 08-27-2013 , 00:54   Changing player's damage.
Reply With Quote #1

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 ??

Last edited by Kz1.0; 08-27-2013 at 00:54.
Kz1.0 is offline
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 08-27-2013 , 05:36   Re: Changing player's damage.
Reply With Quote #2

there's no '+' in theses examples, I think it will be 100*2*3 = 600
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
Old 08-27-2013, 07:16
Thrihaten
This message has been deleted by YamiKaitou. Reason: spambot
Old 08-27-2013, 10:12
LordOfNothing
This message has been deleted by ConnorMcLeod. Reason: troll
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-27-2013 , 12:03   Re: Changing player's damage.
Reply With Quote #3

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.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Old 08-27-2013, 12:09
Black Rose
This message has been deleted by Black Rose. Reason: nvm...
President
Member
Join Date: May 2013
Old 08-27-2013 , 12:32   Re: Changing player's damage.
Reply With Quote #4

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?
President is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-27-2013 , 14:03   Re: Changing player's damage.
Reply With Quote #5

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.
__________________

Last edited by Black Rose; 08-27-2013 at 16:40.
Black Rose is offline
Kz1.0
Senior Member
Join Date: Jan 2013
Location: Vietnam
Old 08-27-2013 , 15:09   Re: Changing player's damage.
Reply With Quote #6

Thanks all
Kz1.0 is offline
President
Member
Join Date: May 2013
Old 08-27-2013 , 16:36   Re: Changing player's damage.
Reply With Quote #7

Quote:
Originally Posted by Black Rose View Post
HAM_SUPERCEDE in either plugin will make it block damage completely.
Lul?
President is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-27-2013 , 16:39   Re: Changing player's damage.
Reply With Quote #8

That is indeed very funny. I'm still laughing after writing it.
... ?
__________________
Black Rose 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 19:13.


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