LeroY Posted June 24, 2017 Share Posted June 24, 2017 How to change the running speed of the player? SetElementVelocity does not work! Link to comment
WorthlessCynomys Posted June 24, 2017 Share Posted June 24, 2017 (edited) Hey... i was like, i don't reply cuz it does not help you, but... i don't think it is possible. Edited June 24, 2017 by StormFighter Missing letter Link to comment
LeroY Posted June 24, 2017 Author Share Posted June 24, 2017 1 hour ago, StormFighter said: Hey... i was like, i don't reply cuz i does not help you, but... i don't think it is possible. I do not know English well, sorry for mistakes. I know that the speed can be changed by including glitch "sprintfast", and then with the client setPedControl ("Sprint", false) or setPedControl ("Sprint" true) in onClientRender with a delay of 10-50 ms But this speed is not enough, or I do something wrong ... Link to comment
WorthlessCynomys Posted June 24, 2017 Share Posted June 24, 2017 1 minute ago, LeroY said: I do not know English well, sorry for mistakes. I know that the speed can be changed by including glitch "sprintfast", and then with the client setPedControl ("Sprint", false) or setPedControl ("Sprint" true) in onClientRender with a delay of 10-50 ms But this speed is not enough, or I do something wrong ... Well... sprintfast is a bug, that they fixed and made you able to turn it back on. With setting the sprint control on and off, you can reach a nice, high speed but i don't know of a function that could set the actual speed that the player is running with. Link to comment
Rose Posted June 25, 2017 Share Posted June 25, 2017 speed = 1.5 if speed[localPlayer] == true then if getControlState( "sprint" ) == true or getControlState("jump") == true then local x, y, z = getElementPosition(getLocalPlayer()) local prot = getPedRotation(getLocalPlayer()) local nx, ny = getPointFromDistanceRotation(x, y, speed, (prot)*-1) local clear = isLineOfSightClear( x, y, z, nx, ny, z, true, true, true, true, true, true, true) if clear == true then local lx, ly = getPointFromDistanceRotation(x, y, 1, (prot-8)*-1) local rx, ry = getPointFromDistanceRotation(x, y, 1, (prot+8)*-1) local clearl = isLineOfSightClear( x, y, z, lx, ly, z, true, true, true, true, true, true, true) local clearr = isLineOfSightClear( x, y, z, rx, ry, z, true, true, true, true, true, true, true) if clearl == true and clearr == true then local nz = getGroundPosition ( nx, ny, z+1 ) if getDistanceBetweenPoints3D( x, y, z, nx, ny, nz) < 2 then setElementPosition(getLocalPlayer(), nx, ny, nz+1, false) end end end end end Use with onClientRender event. Not is my code. Link to comment
LeroY Posted June 25, 2017 Author Share Posted June 25, 2017 2 hours ago, Rose said: speed = 1.5 if speed[localPlayer] == true then if getControlState( "sprint" ) == true or getControlState("jump") == true then local x, y, z = getElementPosition(getLocalPlayer()) local prot = getPedRotation(getLocalPlayer()) local nx, ny = getPointFromDistanceRotation(x, y, speed, (prot)*-1) local clear = isLineOfSightClear( x, y, z, nx, ny, z, true, true, true, true, true, true, true) if clear == true then local lx, ly = getPointFromDistanceRotation(x, y, 1, (prot-8)*-1) local rx, ry = getPointFromDistanceRotation(x, y, 1, (prot+8)*-1) local clearl = isLineOfSightClear( x, y, z, lx, ly, z, true, true, true, true, true, true, true) local clearr = isLineOfSightClear( x, y, z, rx, ry, z, true, true, true, true, true, true, true) if clearl == true and clearr == true then local nz = getGroundPosition ( nx, ny, z+1 ) if getDistanceBetweenPoints3D( x, y, z, nx, ny, nz) < 2 then setElementPosition(getLocalPlayer(), nx, ny, nz+1, false) end end end end end Use with onClientRender event. Not is my code. Thank you so much 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