Raised This Month: $32 Target: $400
 8% 

Just a stupid Question..About Damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
davidto1995
Member
Join Date: Jul 2010
Location: hong kong
Old 07-30-2010 , 18:36   Just a stupid Question..About Damage
Reply With Quote #1

how can i increase the damage or decrease it?
i mean increase or decrease on percentage(%)
davidto1995 is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 07-30-2010 , 20:06   Re: Just a stupid Question..About Damage
Reply With Quote #2

I don't know if this is the best method or the correct one, but tell me if it work and if this is what you want:

Code:
#include <amxmodx> #include <hamsandwich> #define PLUGIN  "Increase Damage by Porcent" #define AUTHOR  "Alucard" #define VERSION "0.0.1" #define PORCENT 50 public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);         RegisterHam(Ham_TakeDamage, "player", "FwdTakeDamage"); } public FwdTakeDamage(id, iInflictor, iAttacker, Float:fDamage, iDamagebits) {     new Float:fResult = (fDamage * PORCENT) / 100;         fDamage += fResult;         SetHamParamFloat(4, fDamage);         return HAM_HANDLED; }

This should take the 50% of the damage, and then increase that porcent to the default damage.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...

Last edited by Alucard^; 07-30-2010 at 20:20.
Alucard^ is offline
Send a message via Skype™ to Alucard^
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-30-2010 , 20:31   Re: Just a stupid Question..About Damage
Reply With Quote #3

Alucard, you must use a float for the entire calculation.

#define PORCENT 50.0

new Float:fResult = (fDamage * PORCENT) / 100.0;

Why not just set PORCENT as a percentage ( 0.5 , 0.75 , 1.5 ) etc. Then you will not need to divide by 100.
__________________

Last edited by Bugsy; 07-30-2010 at 20:46.
Bugsy is offline
davidto1995
Member
Join Date: Jul 2010
Location: hong kong
Old 07-30-2010 , 20:57   Re: Just a stupid Question..About Damage
Reply With Quote #4

..i can't understand at all..
can someone just make a easy explanation for me
PS:i come form Hong Kong my english is poor= =
#define PORCENT 50

public FwdTakeDamage(id, iInflictor, iAttacker, Float:fDamage, iDamagebits)
{
new Float:fResult = (fDamage * PORCENT) / 100;

fDamage += fResult;
so it means increase 50% damage?

Last edited by davidto1995; 07-30-2010 at 21:00.
davidto1995 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-30-2010 , 21:04   Re: Just a stupid Question..About Damage
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <hamsandwich>

const FloatfDmgPercent 0.50;

public 
plugin_init()
{
    
RegisterHam(Ham_TakeDamage"player""FwdTakeDamage");
}

public 
FwdTakeDamageiVictim iInflictor iAttacker Float:fDamage iDamagebits )
{
    
//fDamage passed to this forward is the amount of damage caused to victim
    
    //Here you multiply the damage value by whatever multiplier you want.
    //In this example, fDmgPercent is 0.50 meaning the damage amount will
    //be reduced by half.
    
new FloatfResult = ( fDamage fDmgPercent );
    
    
//This modifies the damage value passed to the game engine to make
    //our calculated damage value take effect.
    
SetHamParamFloatfResult );
    
    return 
HAM_HANDLED;

__________________
Bugsy is offline
davidto1995
Member
Join Date: Jul 2010
Location: hong kong
Old 07-30-2010 , 21:19   Re: Just a stupid Question..About Damage
Reply With Quote #6

THX =]
davidto1995 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 16:54.


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