Garry's Mod

Garry's Mod

Guitar SWEPs Pack
roguex100 5 May, 2014 @ 2:10am
Some help with the Coding
Feel free to delete this thread when you've gotten the info you need.

1.) Create a new blank Lua file (name it whatever) in the autorun folder.

2.)Open the new lua file and put this code for every song. Here I'm using last resort as an example.

sound.Add(
{
name = "GuitarSwep_Last_Resort", ------------Whatever you want to name the sound.
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = SNDLVL_150dB,
sound = "weapons/lastresort.mp3" ---------------Path to the sound file
})

3.) Now go to your swep.

4.) I would put a viewmodel (Even if its just temporary) for the sweps as it spams the console otherwise. So something like:

SWEP.ViewModelFOV = 50
SWEP.ViewModelFlip = false
SWEP.ViewModel = "models/weapons/v_hands.mdl"

5.) Now change the actual lua of these functions for each guitar swep to:

function SWEP:PrimaryAttack()
self.Weapon:EmitSound("GuitarSwep_Last_Resort") -------Sound we added earlier.
end

function SWEP:SecondaryAttack()
self.Weapon:StopSound("GuitarSwep_Last_Resort") -------Stops the sound with RMB.
end

function SWEP:Deploy()
return true
end

function SWEP:Holster()
return true
end

Anyways I hope this helps.
Last edited by roguex100; 5 May, 2014 @ 2:20am
< >
Showing 1-1 of 1 comments
Celnak  [developer] 6 May, 2014 @ 7:03am 
Thanks a BUNCH You Rock!
< >
Showing 1-1 of 1 comments
Per page: 1530 50