Jump to content

[HELP] Walking without pressing ALT


Recommended Posts

Hey everyone!

I'd like to make a script that makes my character walk insted of running without pressing the walk button. So the default movement should be walking. I don't know how to start, any ideas please?

Link to post
function FORCE_PLAYER_WALK( player, condition )
   if( condition == true ) then
      bindKey(player, "w", "down", function() setControlState(player, "walk", true) setControlState(player, "forwards", true) end)
      bindKey(player, "w", "up", function() setControlState(player, "walk", false) setControlState(player, "forwards", false) end)
      toggleControl( player, "sprint", false )
      toggleControl( player, "forwards", false )
      toggleControl( player, "backwards", false )
      toggleControl( player, "left", false )
      toggleControl( player, "right", false )
   elseif( condition == false ) then
      toggleControl( player, "sprint", true )
      toggleControl( player, "forwards", true )
      toggleControl( player, "backwards", true )
      toggleControl( player, "left", true )
      toggleControl( player, "right", true )
      unbindKey( player, "w", "down" )
      unbindKey( player, "w", "up" )
  else
  	  return nil
   end
end

addCommandHandler("force",
    function( player )
       FORCE_PLAYER_WALK( player, true )
    end
	)

addCommandHandler("forceend",
    function( player )
       FORCE_PLAYER_WALK( player, false )
    end
	)

maybe like that?

  • Thanks 1
Link to post

This was a great help, thank you! I made some modifications, walking now is always forced and I also added left/right/backwards movement. It seems like it's working just like I imagined, thanks again!

  • Like 1
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...