[Support] Disable Function (Damage) of Grenades and Tacticals

Topic created · 4 Posts · 117 Views
  • Hello Guys!

    I´m trying to disable the Damage of Schockcharges, Semtex, Flashbangs ... but its not working with my corrent Script, can someone help!?

    Extract from the script: (onPlayerDamage)

        if ( StrTok(sWeapon, "_")[0] == "frag_grenade" )
        {
            iDamage = 0;
        }
       
        if ( StrTok(sWeapon, "_")[0] == "concussion_grenade_mp" )
        {
            iDamage = 0;
        }
       
        if ( StrTok(sWeapon, "_")[0] == "sticky_grenade_mp" )
        {
            iDamage = 0;
        }
       
        if ( StrTok(sWeapon, "_")[0] == "willy_pete_mp" )
        {
            iDamage = 0;
        }
       
        if ( StrTok(sWeapon, "_")[0] == "hatchet_mp" )
        {
            iDamage = 100;
        }
       
        if ( StrTok(sWeapon, "_")[0] == "sensor_grenade_mp" )
        {
            iDamage = 0;
        }
       
        if ( StrTok(sWeapon, "_")[0] == "bouncingbetty_mp" )
        {
            iDamage = 0;
        }
       
        if ( StrTok(sWeapon, "_")[0] == "emp_grenade_mp" )
        {
            iDamage = 0;
        }
       
        if ( StrTok(sWeapon, "_")[0] == "satchel_charge_mp" )
        {
            iDamage = 0;
        }
       
        if ( StrTok(sWeapon, "_")[0] == "proximity_grenade_mp" )
        {
            iDamage = 0;
        }
       
        if ( StrTok(sWeapon, "_")[0] == "claymore_mp" )
        {
            iDamage = 0;
        }
       
        if ( StrTok(sWeapon, "_")[0] == "pda_hack_mp" )
        {
            iDamage = 0;
        }
       
        if ( StrTok(sWeapon, "_")[0] == "trophy_system_mp" )
        {
            iDamage = 0;
        }
       
        if ( StrTok(sWeapon, "_")[0] == "flash_grenade_mp" )
        {
            iDamage = 0;
    

    THANKS ❤

  • What you're actually interested in, is the smeansofdeath paramater.
    With it, you match against damage types.
    Here are a few ones that should get you pretty far.
    MOD_GRENADE_SPLASH
    MOD_IMPACT
    MOD_GAS
    MOD_EXPLOSIVE
    You can find more by e.g. just iprintlning the parameter and then testing all kinds of damage.

    onplayerdamage(einflictor, eattacker, idamage, idflags, smeansofdeath, sweapon, vpoint, vdir, shitloc, psoffsettime)
    {
    	if(smeansofdeath == "MOD_GRENADE_SPLASH" || smeansofdeath == "MOD_IMPACT" || smeansofdeath == "MOD_GAS" || smeansofdeath == "MOD_EXPLOSIVE")
    		idamage = 0;
    	return idamage;
    }
    

    But really, this is probably for trickshotting? Maybe just allow damage from the weapon class sniper, and ignore everything else?

  • @Ox_ said in Disable Function (Damage) of Grenades and Tacticals:

    But really, this is probably for trickshotting? Maybe just allow damage from the weapon class sniper, and ignore everything else?

    How would I do this?

  • @Beatology

    You are splitting the weapon string by every _ take the first element and then compare it against a string that has an _, that is why your code is not and will never work.

Log in to reply