Footsteps for certain jobs.

Is there a way to add custom footsteps for certain jobs?

You could check for the job & use

GM:PlayerFootstep this hook.

Would you mind quickly going through how I would do that? Don’t tell me everything but just where I put it, what I put after it, and where i put the wav file <3 lol

Would this effect all jobs?

Depending on how you code it like.
You could do a table in which depending on the job you have it picks a random sound from a table.

So I can’t just add the “GM.PlayerFootsteps” into one of my jobs and it change the footstep sound the the one that I want?

You could do something like this:

[lua]
local FootSteps = {}
FootSteps[“Citizen”] = “NPC_Hunter.Footstep”
FootSteps[“Mayor”] = “NPC_Hunter.Footstep”

hook.Add(“PlayerFootstep”, “Different_Job_Footstep”, function(ply, pos, foot, sound, volume, rf)
if IsValid(ply) and ply:Alive() then
if FootSteps[ply:getDarkRPVar(“job”)] then
ply:EmitSound(FootSteps[ply:getDarkRPVar(“job”)])
return true
end
end
end)
[/lua]

Why not emit the sound from the pos the hook gives you?

If your going to explain something, please explain it like I’m a five year old. I’m new at these things lol.

The only part to really explain, would be this part:

[lua]
FootSteps[“Citizen”] = “NPC_Hunter.Footstep” – To add another one, just do FootSteps[“JobName”] = “Sound_Off_Foot_Step”
FootSteps[“Mayor”] = “NPC_Hunter.Footstep” – FootSteps[“JobName”] = “FootStep_Sound”
[/lua]

Basically, he’s put the jobs into a table. And then described if you’re that job



FootSteps["Mayor"]


That being mayor, then play


"NPC_Hunter.Footstep"

as the footstep sound.
Thus


FootSteps["Mayor"] = "NPC_Hunter.Footstep" 

Means the job “Mayor” has the NPC_Hunter.Footstep sound for his footsteps.

Haha alright thanks guys, one more thing. Where would I put this code?

lua/autorun/server/AnyFileName.lua

Nope, this didn’t do it.

No errors but still have the default walking sounds, here is the code to look at.



local FootSteps = {}
FootSteps["SCP-066"] = "roll"

hook.Add("PlayerFootstep", "Different_Job_Footstep", function(ply, pos, foot, sound, volume, rf)
    if IsValid(ply) and ply:Alive() then
        if FootSteps[ply:getDarkRPVar("job")] then
            ply:EmitSound(FootSteps[ply:getDarkRPVar("job")])
            return true
        end
    end
end)



When you’re in game, make sure sv_allowcslua is 1, and then type this in console: lua_run_cl print(LocalPlayer():getDarkRPVar(“job”)) and also make sure that the sound is correct.

I don’t think you’re in position to be a jerk to anyone, to be honest…

I’m being a jerk? Hello?
I said explain to things like I’m a 5 year old, wtf?