Mmohab Posted April 12, 2020 Share Posted April 12, 2020 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
βurak Posted April 12, 2020 Share Posted April 12, 2020 (edited) 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 April 13, 2020 by Burak5312 Link to comment
iwalidza Posted April 13, 2020 Share Posted April 13, 2020 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now