• util.effect on hitgroup?
    1 replies, posted
Hello, I'm trying to create a spark effect on a player when he is headshot. (TTT Gamemode) After digging through the player.lua file I found this function but I can't seem to get this to work: [code] function GM:ScalePlayerDamage(ply, hitgroup, dmginfo) if dmginfo:IsBulletDamage() and ply:HasEquipmentItem(EQUIP_ARMOR) then -- Body armor nets you a damage reduction. dmginfo:ScaleDamage(0.7) end ply.was_headshot = false -- actual damage scaling if hitgroup == HITGROUP_HEAD then -- EFFECT SHIT STARTS HERE local effectdata = EffectData() effectdata:SetOrigin( ply:GetPos() ) effectdata:SetNormal( ply:GetPos() ) effectdata:SetMagnitude( 8 ) effectdata:SetScale( 1 ) effectdata:SetRadius( 16 ) util.Effect( "Sparks", effectdata ) -- headshot if it was dealt by a bullet ply.was_headshot = dmginfo:IsBulletDamage() local wep = util.WeaponFromDamage(dmginfo) if IsValid(wep) then local s = wep:GetHeadshotMultiplier(ply, dmginfo) or 2 dmginfo:ScaleDamage(s) end elseif (hitgroup == HITGROUP_LEFTARM or hitgroup == HITGROUP_RIGHTARM or hitgroup == HITGROUP_LEFTLEG or hitgroup == HITGROUP_RIGHTLEG or hitgroup == HITGROUP_GEAR ) then dmginfo:ScaleDamage(0.55) end -- Keep ignite-burn damage etc on old levels if (dmginfo:IsDamageType(DMG_DIRECT) or dmginfo:IsExplosionDamage() or dmginfo:IsDamageType(DMG_FALL) or dmginfo:IsDamageType(DMG_PHYSGUN)) then dmginfo:ScaleDamage(2) end end [/code] Would anyone happen to know what I'm doing wrong? Thanks
util.Effect( "Sparks", effectdata,true,true )
Sorry, you need to Log In to post a reply to this thread.