AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Change the weapon base damage (https://forums.alliedmods.net/showthread.php?t=208514)

darktemplar 02-14-2013 13:50

Change the weapon base damage
 
Hi,
My question is how to change base damage of a weapon
For example, the base damage of M4A1 is 31, and it is multi with the hit place
How can I chage it to 60? :)
Thanks :)

naven 02-14-2013 15:36

Re: Change the weapon base damage
 
Code:

RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage");
and an example code
Code:

public ham_TakeDamage(this, idinflicter, idattacker, Float:damage, damagebits)
{       
        if(!(is_user_alive(idattacker)))
        return PLUGIN_HANDLED;
        new clip, ammo, weapon = get_user_weapon(idattacker, clip, ammo);
               
        if(!is_user_alive(this) || !is_user_alive(idattacker))
        return HAM_IGNORED;
       
        if(weapon == CSW_AK47 && hasgoldenak[idattacker] == 1) {
               
        SetHamParamFloat(4, (damage * 1.2)); //1.0
        }
        if((weapon == CSW_M4A1) && ((hasgoldenak[idattacker] == 1) || (hasgoldenak[idattacker] == 1))){
               
        SetHamParamFloat(4, (damage * 1.2));
        }
        return HAM_HANDLED;
}

Code:

SetHamParamFloat(4, (damage * 1.2));
(1.2)Is 120% dmg
2.0 is 200% dmg
1.0 is 100% dmg

darktemplar 02-14-2013 18:31

Re: Change the weapon base damage
 
Thank you, but you do not understand what I said.
I want a module or plugin which can help me change the base damage of a weapon, such as M4A1. When a weapon cause damage to your body, its base damage is multiplied with hit group (body part which the bullet hit), the only thing I want is to change the base damage, not the damage it cause to a player

Doc-Holiday 02-14-2013 18:48

Re: Change the weapon base damage
 
Quote:

Originally Posted by darktemplar (Post 1894528)
Thank you, but you do not understand what I said.
I want a module or plugin which can help me change the base damage of a weapon, such as M4A1. When a weapon cause damage to your body, its base damage is multiplied with hit group (body part which the bullet hit), the only thing I want is to change the base damage, not the damage it cause to a player

take alook at the weapon modifier plugin. its in the approved section think.

darktemplar 02-15-2013 02:45

Re: Change the weapon base damage
 
Hm...
I've found this : http://code.google.com/p/cs-sdk/sour...pec=svn83&r=83

Look at:

float flDamage;
float flRangeModifier;

if ( FBitSet( m_fWeaponState, WEAPONSTATE_M4A1_SILENCED ) )
{
flDamage = 33.0;
flRangeModifier = 0.95;
}
else
{
flDamage = 32.0
flRangeModifier = 0.97;

m_pPlayer->pev->effects |= EF_MUZZLEFLASH;
}

Vector vecDir = m_pPlayer->FireBullets3( m_pPlayer->GetGunPosition(), gpGlobals->v_forward,
flSpread, 8192.0, 2, 12, flDamage, flRangeModifier, m_pPlayer->pev, 0, m_pPlayer->random_seed );


flDamage is the base damage of M4A1

And it is calculated and done to victim in FireBullets3
My question is : How to hook FireBullet and FireBullets3

Doc-Holiday 02-15-2013 07:45

Re: Re: Change the weapon base damage
 
Quote:

Originally Posted by darktemplar (Post 1894697)
Hm...
I've found this : http://code.google.com/p/cs-sdk/sour...pec=svn83&r=83

Look at:

float flDamage;
float flRangeModifier;

if ( FBitSet( m_fWeaponState, WEAPONSTATE_M4A1_SILENCED ) )
{
flDamage = 33.0;
flRangeModifier = 0.95;
}
else
{
flDamage = 32.0
flRangeModifier = 0.97;

m_pPlayer->pev->effects |= EF_MUZZLEFLASH;
}

Vector vecDir = m_pPlayer->FireBullets3( m_pPlayer->GetGunPosition(), gpGlobals->v_forward,
flSpread, 8192.0, 2, 12, flDamage, flRangeModifier, m_pPlayer->pev, 0, m_pPlayer->random_seed );


flDamage is the base damage of M4A1

And it is calculated and done to victim in FireBullets3
My question is : How to hook FireBullet and FireBullets3

Rage or the other one I can't spell


All times are GMT -4. The time now is 20:35.

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