Gmod Addon help

im trying to make an simple addon that when i press E on an cube it makes an sound. the code is working the entity is spawnig. but the problem is that the sound do not work it says “file probably missing from disk/repository”
where should i put the sound file? how do i convert the cl_init, shared and init into 1 .gma archive? (sorry im pretty bad at this)

this is how the init.lua is now:

Try moving the sound from the lua folder to the sound folder

[editline]20th March 2016[/editline]

Also, you can make .gma files pretty easily using something like this (which is what I always use)

In the screenshot, I see you used Sound() like this:




Sound"YourSound"



It MIGHT work if you do this:




Sound("YourSound")



That’s not it. That’s valid syntax.

Go to: http://www.lua.org/cgi-bin/demo and try this:



local function Asd( Test )


   return Test


end


local a = Asd "Shit"
print( a )


“There is a special case to this rule: If the function has one single argument and this argument is either a literal string or a table constructor, then the parentheses are optional:”

@OP

That error occurs when, as it suggets, the file is missing. You probably did not force the client to download the sound. Also, keep in mind, with your current setup, you’re not exactly making an addon, you’re just adding files onto /lua/
Also, that sound path is incorrect. Sounds are retrieved from the sounds folder, so unless you have a folder called “lua” in “sounds” that contains another folder called “entities” inside “lua”… etc… you get the point. It’s not going to work.

its says *** Invalid sample rate (48000) for sound ‘pew1.wav’. now

You will have to change the sample rate using a program like Audacity. It’s quite simple, google it there should be some stuff for it.