Garry's Mod

Garry's Mod

Guitar SWEPs Pack
roguex100 5. maj 2014 kl. 2:10
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.
Sidst redigeret af roguex100; 5. maj 2014 kl. 2:20
< >
Viser 1-1 af 1 kommentarer
Celnak  [udvikler] 6. maj 2014 kl. 7:03 
Thanks a BUNCH You Rock!
< >
Viser 1-1 af 1 kommentarer
Per side: 1530 50