Catalyst Gaming
General => Support & Help => Topic started by: FuriousJack95 on June 02, 2011, 07:51:27 PM
-
Trying to code something so that if a player headshots someone it plays a sound on the player and the victim and anyone near them from a list
-
what are you making this sound file for ?
-
what are you making this sound file for ?
Trolling
So when someone gets a headshot it goes R U ON TEH BALL?
or FUCKIN LAG U PISASHIT
-
Google
-
function Headshot(ply, hitgroup, dmginfo)
if ply:Health() > dmginfo:GetDamage() then
if hitgroup == HITGROUP_HEAD then
ply:EmitSound(table.Random({pathtosound.wav, pathtosound.wav, pathtosound.wav}), 100, 100)
end
end
end
hook.Add("ScalePlayerDamage", "HeadshotStuff", Headshot)
pathtosound is the sound relative to the 'sound' directory.
Might not work. I don't know if checking the player's health on scaleplayerdamage will return their health before or after the damage is added.
-
function BOOMHeadShot( victim, attacker, dmginfo )
if victim:LastHitGroup() == 1 then
victim:EmitSound(table.Random({pathtosound.wav, pathtosound.wav, pathtosound.wav}), 100, 100)
end
end
hook.Add( "DoPlayerDeath", "HeadShot", BOOMHeadShot )
I couldnt be bothered to rewrite the sound playing aswell, so I stole it from JoshB as it looked fine, so "ply:EmitSound(table.Random({pathtosound.wav, pathtosound.wav, pathtosound.wav}), 100, 100)" should be credited to him, me the rest :)