Raised This Month: $ Target: $400
 0% 

Change the weapon base damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
darktemplar
Member
Join Date: Sep 2009
Old 02-14-2013 , 13:50   Change the weapon base damage
Reply With Quote #1

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
darktemplar is offline
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 02-14-2013 , 15:36   Re: Change the weapon base damage
Reply With Quote #2

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
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.

Last edited by naven; 02-14-2013 at 15:36.
naven is offline
darktemplar
Member
Join Date: Sep 2009
Old 02-14-2013 , 18:31   Re: Change the weapon base damage
Reply With Quote #3

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
darktemplar is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 02-14-2013 , 18:48   Re: Change the weapon base damage
Reply With Quote #4

Quote:
Originally Posted by darktemplar View Post
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.
Doc-Holiday is offline
darktemplar
Member
Join Date: Sep 2009
Old 02-15-2013 , 02:45   Re: Change the weapon base damage
Reply With Quote #5

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
darktemplar is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 02-15-2013 , 07:45   Re: Re: Change the weapon base damage
Reply With Quote #6

Quote:
Originally Posted by darktemplar View Post
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
Doc-Holiday is offline
Reply


Thread Tools
Display Modes

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 20:35.


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