I need help with a death sound addon I made, hope this is right thread, I don't understand lua

So recently I thought it would be funny if I replaced the death sound with the death sound of the original Crash Bandicoot, https://www.youtube.com/watch?v=78KbTXlDrlg here’s the clip if you wanted to hear it. So then I followed this video, https://www.youtube.com/watch?v=l8Y6FBV9UQs it works but only in single player, I wanted to make it work on any multiplayer server if that’s possible. So me being stupid I went to the help tab in steam discussions asking for help. Didn’t think about coming here until someone told me. He also said “there’s a better way to do this” then the way I was doing. Here’s a pastebin of what the code is in the lua script: https://pastebin.com/ZNmcBim8 and I also have notepad++ so that should make things slightly easier.

As you can’t run lua on all multiplayer servers without them having sv_allowcslua 1. I would probably override the original death sound with your one. What you have to do is to find what sound GMod uses when you die and the path of it. Then create an addon that has a sound with the same name in the same path.

Check for errors in your ingame / server console.

You need to make sure the soundfiles are sent to the client, but that should throw an error too.

So not sure if i’m just stupid but I go in the common GarrysMod folder and type in sound to try to find the death sound, but I can’t find it. Is there a better tool I could use to search for it?

You’ll need to manually add the death sound to your client folders.

Check the console like I said. If the sound is missing it would have told you.

I just don’t know what you mean by client folders, I understand what your telling me to do, but I just can’t find the client folders. I feel stupid that I can’t find it. Do I need to make one?

Wherever the sound is on the server, you need to put it there on the client too. It’s probably something like garrysmod/garrysmod/sound/addonname/filename.wav

Wait does it also need to be on the server to work? I wanna make it so only I hear it. Sorry if i’m being stupid.

I’ll just summon up everything in a couple of lines:

There are various methods of replacing the death sounds. One of them is to just replace the files of the default death sounds as content on an addon.

The other one is using actual Lua, by using the hook

GM:PlayerDeathSound, but this won’t work on servers that have sv_allowcslua on 1, due to inability of running clientside Lua, unless the server has this addon in particular installed.

And, those are the two methods I can think of right now.

Do you know what the directory would be for the default death sounds?



Next time try using Google a bit more, please.

Thank you and will do.

[editline]24th July 2017[/editline]

I think I might be mentally ill because I just can’t get this to work.

It’s actually programmed as

 // medical
HEV_DEAD0 hl1/fvox/beep beep, beep beep, beep, beep, flatline {Len 6.29 closecaption HEV.Flatline} 


Man i’m getting so confused. Like I understand what your saying I just don’t know what to do with what your saying.

Basically when you die the beeps reproduce around 5 times, and then the flatline sound will get reproduced at the end. Thats what he posted about means.