Raised This Month: $ Target: $400
 0% 

Getting weapon damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-07-2011 , 13:46   Re: Getting weapon damage
Reply With Quote #1

Enter the weapons for which you want damage to be modified in the MULTIPLIER_WEAPONS const in the same way the current ones are listed. Set DMG_MULTIPLIER to the value that you want damage to be multiplied by. Default is 2.0, you can also reduce damage with this by using a value less than 1.0. Let me know if you have any problems, I quickly tested it and it worked. Something like this I'm sure already exists.
PHP Code:
#include <amxmodx>
#include <hamsandwich>

new const Version[] = "0.1";

const 
DMG_GRENADE = ( << 24 );

//Weapons that are affected by the multiplier:
const MULTIPLIER_WEAPONS 

    ( 
<< CSW_HEGRENADE ) | 
    ( 
<< CSW_AWP ) | 
    ( 
<< CSW_AK47 
);

//Damage gets multiplied by this:
const Float:DMG_MULTIPLIER 2.0;

new 
g_iMaxPlayers;

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

public plugin_init() 
{
    
register_plugin"Damage Multiplier" Version "bugsy" );
    
    
RegisterHamHam_TakeDamage "player" "fw_HamTakeDamage" );
    
g_iMaxPlayers get_maxplayers();
}

public 
fw_HamTakeDamageiVictim iInflictor iAttacker Float:fDamage DmgBits )
{
    if ( 
IsPlayeriAttacker ) && 
        ( ( ( 
DmgBits DMG_GRENADE ) && ( MULTIPLIER_WEAPONS & ( << CSW_HEGRENADE ) ) ) || 
        ( !( 
DmgBits DMG_GRENADE ) && ( MULTIPLIER_WEAPONS & ( << get_user_weaponiAttacker ) ) ) ) ) )
    {
        
SetHamParamFloatfDamage DMG_MULTIPLIER );
        return 
HAM_HANDLED;
    }
    
    return 
HAM_IGNORED;

Damage issued
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new const Version[] = "0.1";

public 
plugin_init() 
{
    
register_plugin"Damage" Version "bugsy" )
    
    
RegisterHamHam_TakeDamage "player" "fw_HamTakeDamage" );
}

public 
fw_HamTakeDamageiVictim iInflictor iAttacker Float:fDamage DmgBits )
{
    
//fDamage is the total damage issued to a player. If the victim has armor, the 
    //armor will absorb some of the damage which will result in the victims reduction in hp
    //to be less than fDamage.
    
    //This is the reduction in victims hp.
    
new iDamage peviVictim pev_dmg_take );
    

__________________

Last edited by Bugsy; 08-07-2011 at 14:34.
Bugsy 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 03:27.


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