Fall damage sound.

I need help removing the sound from fall damage and replacing it with a pain sound. I made this function to emit a random paint sound but all I hear is the default crunch when I take falling damage.

[lua]
function falldamagesound(ply)
painsound = {}
painsound[1] = “vo/npc/male01/pain02.wav”
painsound[2] = “vo/npc/male01/pain03.wav”
painsound[3] = “vo/npc/male01/pain04.wav”
painsound[4] = “vo/npc/male01/pain05.wav”
painsound[5] = “vo/npc/male01/pain06.wav”
painsound[6] = “vo/npc/male01/pain07.wav”
painsound[7] = “vo/npc/male01/pain08.wav”
painsound[8] = “vo/npc/male01/pain09.wav”

randnum = math.Random(1, 9)
randsound = painsound[randnum]

ply:EmitSound(randsound, 100, 100)

end

hook.Add(“GetFallDamage”, “painfall”, falldamagesound)
[/lua]

DarkSpider had a problem like this somewhat recently.

Solution

Return true in OnPlayerHitGround to block the default sound.

Thank you. Any idea why I don’t hear mine though?

Is that hook serverside?

Oh it’s math.random not math.Random. XD

Wasn’t showing up in debug before.

Ah yes, anyway when selecting a random item of a table, use table.Random( table ) :slight_smile:

Oh thank you! ;D