Question How to change weapon damage? (GSC)

WaRoxYtb02

Member
Messages
14
Points
28
Hello,

In my project, I need to change the damage of weapons.
(pack a punch system)

Is there a way to do it?
 

StupidEdits

New Member
Messages
2
Points
3
Hello,

In my project, I need to change the damage of weapons.
(pack a punch system)

Is there a way to do it?
Wrong section - Aside from that, afaik you'd need to be able to modify weaponfiles we can't access to change the damage directly.

An alternative is to waittill someone or something is damaged, check what weapon that damage came from, and apply extra damage on top of the weapon.
 

TheHiddenHour

Well-Known Member
Messages
59
Points
228
Hello,

In my project, I need to change the damage of weapons.
(pack a punch system)

Is there a way to do it?
Put level.onplayerdamage = ::onplayerdamage; in init.
Put this function somewhere in your project:
PHP:
onplayerdamage( einflictor, eattacker, idamage, idflags, smeansofdeath, sweapon, vpoint, vdir, shitloc, psoffsettime )
{
    // Runs everytime something takes damage
}
This is an override function that the game uses in some gamemodes like One In The Chamber, so it's neater to use rather than making your own monitor using waittills. Every time something in the game takes damage, this function will be called on the entity taking damage and its contents will be executed. Here's some psuedo code that could help you with your pack a punch idea :blush::
PHP:
onplayerdamage( einflictor, eattacker, idamage, idflags, smeansofdeath, sweapon, vpoint, vdir, shitloc, psoffsettime )
{
    if(eattacker.has_pap) // If the attacker has a pack-a-punchable weapon equipped
    {
        if(sweapon == "fiveseven_mp") // If the pack-a-punched weapon is a fiveseven
            self.health -= 100; // Subtract 100 health from the victim's health
    }
}
 
Top