Raised This Month: $ Target: $400
 0% 

Getting weapon damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
r14170
Veteran Member
Join Date: Dec 2009
Old 08-07-2011 , 10:19   Getting weapon damage
Reply With Quote #1

How do i get damage dealt from a weapon?
r14170 is offline
avril-lavigne
Banned
Join Date: Apr 2009
Old 08-07-2011 , 10:32   Re: Getting weapon damage
Reply With Quote #2

Ham_Takedamage
also event damage

look for damager.sma
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc
avril-lavigne is offline
r14170
Veteran Member
Join Date: Dec 2009
Old 08-07-2011 , 11:57   Re: Getting weapon damage
Reply With Quote #3

when i get the damage from a HE (for example) and then double it? sry for stupid questions
r14170 is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-07-2011 , 12:08   Re: Getting weapon damage
Reply With Quote #4

Are you asking how to double damage?

SetHamParamFloat( 4, Float:flDamage * 2 );
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 08-07-2011 , 12:21   Re: Getting weapon damage
Reply With Quote #5

To get damage done by a grenade do this:
PHP Code:
public plugin_init()
    
RegisterHam(Ham_TakeDamage"player""FwdPlayerTakeDamage");

public 
FwdPlayerTakeDamage(iVictimiInflictoriAttackerFloatflDamageiDmgBits)
{
    if(
iDmgBits & (1<<24))
    {
        
// Grenade damage
    
}

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
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 #6

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
r14170
Veteran Member
Join Date: Dec 2009
Old 08-07-2011 , 16:39   Re: Getting weapon damage
Reply With Quote #7

Thanks Bugsy! helped me a lot!
r14170 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