Garry's Mod

Garry's Mod

Guitar SWEPs Pack
roguex100 2014 年 5 月 5 日 上午 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.
最后由 roguex100 编辑于; 2014 年 5 月 5 日 上午 2:20
< >
正在显示第 1 - 1 条,共 1 条留言
Celnak  [开发者] 2014 年 5 月 6 日 上午 7:03 
Thanks a BUNCH You Rock!
< >
正在显示第 1 - 1 条,共 1 条留言
每页显示数: 1530 50