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

Change weapon damage in HL1


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
muro32
Junior Member
Join Date: Dec 2019
Old 02-01-2024 , 09:30   Change weapon damage in HL1
Reply With Quote #1

Hello all. I need to reduce the damage of 9mmAR's grenade and shotgun(both of primary and secondary attack) in my server. Skill.cfg did'nt worked for me. How can i solve it? Codes in this reply look like useful, how can i adapt shotgun and 9mmAR's grenade? Thank you.
muro32 is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 02-01-2024 , 11:47   Re: Change weapon damage in HL1
Reply With Quote #2

identify the weapon HLW_?
__________________
mlibre is offline
muro32
Junior Member
Join Date: Dec 2019
Old 02-01-2024 , 15:50   Re: Change weapon damage in HL1
Reply With Quote #3

Quote:
Originally Posted by mlibre View Post
identify the weapon HLW_?
HLW_SHOTGUN for shotgun, HLW_MP5 for 9mmAR but unfortunately I don't know if there is a different ident for 9mmar's grenade. And I have no idea how to adjust primary and secondary attack damage separately.
muro32 is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 02-03-2024 , 10:47   Re: Change weapon damage in HL1
Reply With Quote #5

you can identify exactly the type of damage with a print with the help of Ham_TakeDamage
__________________
mlibre is offline
muro32
Junior Member
Join Date: Dec 2019
Old 02-06-2024 , 06:39   Re: Change weapon damage in HL1
Reply With Quote #6

this block can help me thank you
muro32 is offline
muro32
Junior Member
Join Date: Dec 2019
Old 02-06-2024 , 06:39   Re: Change weapon damage in HL1
Reply With Quote #7

Quote:
Originally Posted by mlibre View Post
you can identify exactly the type of damage with a print with the help of Ham_TakeDamage
ok i will try this at weekend thank you
muro32 is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 02-09-2024 , 10:37   Re: Change weapon damage in HL1
Reply With Quote #8

Tested OK.
PHP Code:
#include amxmodx
#include fakemeta
#include hamsandwich

#define PLUGIN "AR SHOTTY DAMAGE ADJ"
#define VERSION "1.0"

new const CvarXMultiplerDesc[]="Damage multiplier"

new const gWeaponClassname[] = "weapon_shotgun"
new bool:bShottyAttack[MAX_PLAYERS +1]
new 
Float:XMultipler

public plugin_init()
{
    
register_plugin(PLUGINVERSION".sρiηX҉.");
    
    
RegisterHamHam_Weapon_PrimaryAttack  gWeaponClassname"Weapon_Attack_Pre" )
    
RegisterHamHam_Weapon_PrimaryAttack  gWeaponClassname"Weapon_Attack_Post" )

    
RegisterHamHam_Weapon_SecondaryAttack  gWeaponClassname"Weapon_Attack_Pre" )
    
RegisterHamHam_Weapon_SecondaryAttack  gWeaponClassname"Weapon_Attack_Post" )
    
RegisterHam(Ham_TakeDamage"player""Event_Damage"0);
    
bind_pcvar_float(get_cvar_pointer("mp_damage_multiplier") ?
    
get_cvar_pointer("mp_damage_multiplier") :
    
create_cvar("mp_damage_multiplier""0.1"FCVAR_SERVERCvarXMultiplerDesc,.has_min true, .min_val 0.0, .has_max true, .max_val 10.0), XMultipler)
}

public 
Weapon_Attack_Pre( const weapon )
{
    static 
iPlayer;iPlayer pev(weaponpev_owner)
    
bShottyAttack[iPlayer] = true
}

public 
Weapon_Attack_Post( const weapon )
{
    static 
iPlayer;iPlayer pev(weaponpev_owner)
    
bShottyAttack[iPlayer] = false
}

public 
Event_Damage(victiminflictorattackerFloat:fDamagedmgbits)
{
    if(
is_user_connected(attacker))
    {
        
#define DAMAGE       4
        
new Float:Damage_adj  fDamage*XMultipler;

        if(
bShottyAttack[attacker] || dmgbits == DMG_BLAST )
        {
            if(!
XMultipler)
                return 
HAM_SUPERCEDE
            
else
                
SetHamParamFloat(DAMAGEDamage_adj)
            
client_print attackerprint_center"%i"floatround(Damage_adj)
        }
        else return 
HAM_IGNORED
    
}
    return 
PLUGIN_HANDLED


__________________

Last edited by DJEarthQuake; 02-09-2024 at 17:26. Reason: added primary
DJEarthQuake 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 17:15.


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