Random Lua questions

I have a bunch of miscellaneous questions about Lua scipting for Garrysmod.

How can i play music during gameplay?

How can i disable the Q menu and C menu?

What side (client,server, or shared) would i put the function GM.PlayerCanNoClip?

I admit i am a n00b but please bear with me.

Music / sounds: http://wiki.garrysmod.com/?title=Csoundpatch

Q menu: http://wiki.garrysmod.com/?title=Gamemode.SpawnMenuOpen

Server side and that is no function.

oh silly me

thanks for the help

one more thing server side is init right? sorry im new to this


i put

 Sound = CreateSound(computah, Sound("hl1/ambience/computalk2.wav"))
Sound:PlayEx(0.5, 100) //Plays a sound with 50% volume and 100% pitch coming from entity "computah" 

but nothing happens, no noise or anything at all

GM.PlayerCanNoClip is shared

First of all, where did you put it? Which file + which function.

Never heard of CreateSound(), but there’s alot of things I havent heard of. Try using **[Surface.PlaySound

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Surface.PlaySound)** instead though.

does it have to be in a specific format? mine is in wma


and client is cl_init.lua right?

I dont know actually, all the files I’ve seen been played are .wav though.

And cl_init is clientside, yes.

mp3 work too i believe


Thats just the wiki example. Replace computah with LocalPlayer() or another entity that will play the sound.