Jump to content

[HELP] - Walking style


Mmohab

Recommended Posts

Hello guys .. I hope you are fine ..
Let's start with the topic
When a player walks, he does not walk slowly but runs
I want to make a script that when the player moves with the w button he is going slow and not running

And when he presses space button
he Running fast

so .. what should i do ?

and what the commands i need to ?

 

thanks.

Link to comment

maybe this work

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
	)

 

Edited by Burak5312
Link to comment
addEventHandler("onClientResourceStart",root,function() -- run when the resource start
    if getPedMoveState(localPlayer) == "powerwalk" then  -- get player move state if the state "power walk" then go to other line
        setPedControlState(localPlayer,"walk", true) -- set player new move state
    end
end)
Link to comment

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...