• Murder gamemode footsteps
    15 replies, posted
Hello, How do i disable footstep sound if you are crouching. or when we press ALT in murder gamemode.
[url]https://wiki.garrysmod.com/page/GM/PlayerFootstep[/url] Check for if the player has IN_WALK held down or is crouching in this hook. Returning true will stop the sound
i dont see any IN_WALK :cry:
[CODE] if someplayer:KeyDown( IN_WALK ) then [/CODE] [editline]12th January 2017[/editline] If it's crouching you probably want to use IN_DUCK
[QUOTE=MPan1;51658092][CODE] if someplayer:KeyDown( IN_WALK ) then [/CODE] [editline]12th January 2017[/editline] If it's crouching you probably want to use IN_DUCK[/QUOTE] Sorry fam, do i have to find the codes or i have to add it cuz i cant find any IN_WALK or IN_DUCK (im new)
You need to override GM:PlayerFootstep (or do it in a hook) and return true if the player is holding a key to prevent playing the sound. So you create a hook with: [lua] hook.Add("PlayerFootstep","NoStepOnKey",function(ply) // Code end) [/lua] Then you want to check if the player is holding one of the keys and if return true to prevent playing the sound: [lua] if ply:KeyDown(IN_WALK) or ply:KeyDown(IN_DUCK) then return true end [/lua] Combined it should look like this: [lua] hook.Add("PlayerFootstep","NoStepOnKey",function(ply) if ply:KeyDown(IN_WALK) or ply:KeyDown(IN_DUCK) then return true end end) [/lua]
[QUOTE=Benn20002;51659136]You need to override GM:PlayerFootstep (or do it in a hook) and return true if the player is holding a key to prevent playing the sound. So you create a hook with: [lua] hook.Add("PlayerFootstep","NoStepOnKey",function(ply) // Code end) [/lua] Then you want to check if the player is holding one of the keys and if return true to prevent playing the sound: [lua] if ply:KeyDown(IN_WALK) or ply:KeyDown(IN_DUCK) then return true end [/lua] Combined it should look like this: [lua] hook.Add("PlayerFootstep","NoStepOnKey",function(ply) if ply:KeyDown(IN_WALK) or ply:KeyDown(IN_DUCK) then return true end end) [/lua][/QUOTE] You're the best Thank you !:goodjob:
[QUOTE=Benn20002;51659136]You need to override GM:PlayerFootstep (or do it in a hook) and return true if the player is holding a key to prevent playing the sound. So you create a hook with: [lua] hook.Add("PlayerFootstep","NoStepOnKey",function(ply) // Code end) [/lua] Then you want to check if the player is holding one of the keys and if return true to prevent playing the sound: [lua] if ply:KeyDown(IN_WALK) or ply:KeyDown(IN_DUCK) then return true end [/lua] Combined it should look like this: [lua] hook.Add("PlayerFootstep","NoStepOnKey",function(ply) if ply:KeyDown(IN_WALK) or ply:KeyDown(IN_DUCK) then return true end end) [/lua][/QUOTE] Theres one more problem , it is working fine if im crouching and alt, but other players will still hear the footsteps
[QUOTE=code_gs;51655489]Returning true will stop the sound[/QUOTE]
[QUOTE=guigui30110;51669904][/QUOTE] Only work for myself , but other people can hear it @@
Are you running the Code shared? Or just clientside?
[QUOTE=Benn20002;51670773]Are you running the Code shared? Or just clientside?[/QUOTE] Clientside , should i put it in shared ?
Yes.
Its not working too. I've add it in shared too
Where are you putting the code exactly? Give us a path.
[QUOTE=Zephruz;51675539]Where are you putting the code exactly? Give us a path.[/QUOTE] murder> gamemode Shared.lua and cl_footsteps
Sorry, you need to Log In to post a reply to this thread.