Hello i would like to set some custom footsteps sounds for certain jobs in my DarkRP server, can someone please give me walkthrough instructions along with code where all i have to do is insert the job names/sound file name?
Thank you
https://wiki.garrysmod.com/page/GM/PlayerFootstep
Can u explain this to me?
function GM:PlayerFootstep( ply, pos, foot, sound, volume, rf )
ply:EmitSound( "NPC_Hunter.Footstep" ) -- Play the footsteps hunter is using
return true -- Don't allow default footsteps
end
Questions:
Where do i place this code in a server?
Should i upload the custom footstep sound to steamworkshop and install it on the server addons?
You should use a hook instead of overriding the gamemode function.
https://gist.github.com/DoctorJew/b159cab4592396ec70b180f28612eb83
https://www.youtube.com/watch?v=gIKFi7wsezg
Hi i seem to be halfway there, the sound doesnt play anymore in game when i walk it is just silent, do i need to make a looped WAV file with just one single footstep or is the setup done below alright.
AddCSLuaFile()
-- Add models to this table with their corrosponding sound.
local soundTable = {
["NPC_Hunter.Footstep"] = {
"models/player/barney.mdl",
"models/player/kleiner.mdl"
},
["doors/door_metal_large_chamber_close1.wav"] = {
"models/player/hostage/hostage_04.mdl"
},
["sound/dinofoot.wav"] = {
"models/trex2pc.mdl"
}
}
-- Change MyCustomFootstep to whatever UNIQUE name you like
hook.Add("PlayerFootstep", "Dinosound", function(ply)
local footstep = nil
for snd, tbl in pairs(soundTable) do
if table.HasValue(tbl, ply:GetModel()) then
footstep = snd
end
end
if !footstep then return end -- If we don't have a custom sound, return
ply:EmitSound(footstep) -- Emit the sound
return true -- Stop the default sound
end)
The sound will not play unless you move. If it's playing while you're not moving then you have another problem.
Yeah it is playing while i am not moving and even while i am in other jobs
Sorry, you need to Log In to post a reply to this thread.