Raised This Month: $51 Target: $400
 12% 

[Question]How To Increase Bullet Damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zombiesucker
Member
Join Date: Sep 2015
Old 12-23-2015 , 07:17   [Question]How To Increase Bullet Damage
Reply With Quote #1

how to increase our bullet damage when we fire useing any weapon??
__________________
Working On :
Bleach Mod : [||||||||||] paused
zombiesucker is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 12-24-2015 , 12:19   Re: [Question]How To Increase Bullet Damage
Reply With Quote #2

You should have searched first because it's not a rare question but anyway. Here is the code:
PHP Code:
#include <amxmodx>
#include <hamsandwich>

new g_amount

public plugin_init( ) 
{
    
RegisterHamHam_TakeDamage"player""fw_TakeDamage" );
    
g_amount register_cvar("amx_damage_increase" "1.5")
}

public 
fw_TakeDamagevictiminflictorattackerFloat:damagedamage_type )
{
    if( 
is_user_aliveattacker ))
    {
        
damage *= get_pcvar_float(g_amount)
        
SetHamParamFloat4damage );
    }

Example :
amx_cvar amx_damage_increase "1.5" - will multiply damage by 1.5 .
siriusmd99 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-24-2015 , 14:33   Re: [Question]How To Increase Bullet Damage
Reply With Quote #3

Attacker not being alive doesn't matter here and you are not checking if the damage is from a bullet. You should return HAM_HANDLED after SetHamParamFloat().

Modified TakeDamage to increase damage from bullets only.
PHP Code:
#define DMG_BULLET (1<<1)     

public fw_TakeDamagevictiminflictorattackerFloat:damagedamage_type )
{
    if ( !( 
damage_type DMG_BULLET ) )
        return 
HAM_IGNORED;  

    
SetHamParamFloatdamage get_pcvar_floatg_amount ) );
    
    return 
HAM_HANDLED;

Modify damage from any weapon, including grenades
PHP Code:
#include <amxmodx>
#include <hamsandwich> 

#define IsPlayer(%1)    (1<=%1<=g_maxplayers)

new g_amount g_maxplayers;

public 
plugin_init( ) 
{
    
RegisterHamHam_TakeDamage "player" "fw_TakeDamage" );

    
g_amount register_cvar"amx_damage_increase" "1.5" );
    
g_maxplayers get_maxplayers();
}

public 
fw_TakeDamagevictim inflictor attacker Float:damage damage_type )
{
    if ( !
IsPlayerattacker ) )
        return 
HAM_IGNORED;  
    
    
SetHamParamFloatdamage get_pcvar_floatg_amount ) );
    
    return 
HAM_HANDLED;

__________________

Last edited by Bugsy; 12-24-2015 at 14:57.
Bugsy is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 12-24-2015 , 16:26   Re: [Question]How To Increase Bullet Damage
Reply With Quote #4

Sorry, i just found that code posted be exolent and i thought it was right. Next time i will check.
siriusmd99 is offline
PartialCloning
Senior Member
Join Date: Dec 2015
Old 12-24-2015 , 16:37   Re: [Question]How To Increase Bullet Damage
Reply With Quote #5

What happens if you don't return HAM_HANDLED?
PartialCloning is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-24-2015 , 17:24   Re: [Question]How To Increase Bullet Damage
Reply With Quote #6

I'm not sure, try it. Documentation states to use HANDLED when you've changed something.

Code:
HAM_IGNORED - Nothing happened, the call continues.
HAM_HANDLED - You did something, but the call continues.
HAM_OVERRIDE - The call will still be executed, but instead you will change the return value.
HAM_SUPERCEDE - The call is not executed, and you use your return value, if applicable
__________________
Bugsy is offline
PartialCloning
Senior Member
Join Date: Dec 2015
Old 12-24-2015 , 18:31   Re: [Question]How To Increase Bullet Damage
Reply With Quote #7

After reading the include, I think it's just for compatibility with other plugins and post hooks. Like if you were to use GetHamReturnFloat it would return the old value unless you used override or superceded it.
PartialCloning is offline
zombiesucker
Member
Join Date: Sep 2015
Old 12-25-2015 , 07:14   Re: [Question]How To Increase Bullet Damage
Reply With Quote #8

thanks all, i have another question,, i'm trying to merg this code to use it with cod mw4 and try make increase our bullet damage with upgrade is it possible?

here is sma to check if needed
Attached Files
File Type: sma Get Plugin or Get Source (TestCod.sma - 451 views - 242.9 KB)
__________________
Working On :
Bleach Mod : [||||||||||] paused

Last edited by zombiesucker; 12-25-2015 at 07:23.
zombiesucker is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 12-25-2015 , 08:13   Re: [Question]How To Increase Bullet Damage
Reply With Quote #9

Quote:
Originally Posted by zombiesucker View Post
thanks all, i have another question,, i'm trying to merg this code to use it with cod mw4 and try make increase our bullet damage with upgrade is it possible?

here is sma to check if needed
I think so, can you test it?
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective
addons_zz is offline
zombiesucker
Member
Join Date: Sep 2015
Old 12-25-2015 , 14:35   Re: [Question]How To Increase Bullet Damage
Reply With Quote #10

increase damage worked put how to upgrade it as same as in the sma if you know how?
__________________
Working On :
Bleach Mod : [||||||||||] paused
zombiesucker 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 08:46.


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