Scripting Moderators ds1-e Posted May 12, 2019 Scripting Moderators Share Posted May 12, 2019 Hey. I would need an idea how i could make faster sprinting by holding space (not tapping). I mean the "fast sprint" glitch. - OnClientKey/bindKey, but what later? I don't have any idea how it could be done, maybe a loop? Link to comment
KaMi Posted May 12, 2019 Share Posted May 12, 2019 hmm i think you can use bindKey and setGameSpeed Link to comment
Scripting Moderators ds1-e Posted May 13, 2019 Author Scripting Moderators Share Posted May 13, 2019 2 hours ago, <~KaMiKaZe~> said: hmm i think you can use bindKey and setGameSpeed I cannot, i am sure that it will change also speed of other actions. Link to comment
JCL Posted May 13, 2019 Share Posted May 13, 2019 use animation for that. you will get smooth fast run without accelerate the game and without glitchs like this mode : 1 Link to comment
Scripting Moderators ds1-e Posted May 13, 2019 Author Scripting Moderators Share Posted May 13, 2019 (edited) 1 hour ago, DicoSky said: use animation for that. you will get smooth fast run without accelerate the game and without glitchs like this mode : lmao. This should be custom or standard animation? Edited May 13, 2019 by majqq Link to comment
JCL Posted May 13, 2019 Share Posted May 13, 2019 its client side script with custom animation combined with setPedAnimationSpeed. custom animation is just a standard animation edited a bit. 1 Link to comment
Mahlukat Posted May 13, 2019 Share Posted May 13, 2019 speed run from Slothman's superpowers script; local obj = {} function WaterWalk() if obj[localPlayer] then local x,y,_ = getElementPosition(localPlayer) setElementPosition(obj[localPlayer],x,y,-.6) end end function WaterOn() local px,py,_ = getElementPosition(localPlayer) obj[localPlayer] = createObject(3095,px,py,-2) setElementAlpha(obj[localPlayer],0) setElementDimension(obj[localPlayer], getElementDimension(localPlayer)) setTimer ( destroyElement, 50, 1, obj[localPlayer]) end function getPointFromDistanceRotation(x, y, dist, angle) local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end speeding = 0 resting = 0 function speedforce( key, keyState, obj ) if keyState == "down" then if speeding == 0 then if isTimer(buildup) then resetTimer(buildup) else buildup = setTimer ( startSpeeding, 1000, 1) end end else if isTimer(buildup) then killTimer(buildup) buildup = nil end if speeding == 1 then outofspeed() end end end bindKey ( "sprint", "both", speedforce ) function startSpeeding() if resting == 0 then speeding = 1 buildup = nil -- endRun = setTimer( outofspeed, 9999999999, 0 ) addEventHandler("onClientRender",getRootElement(), speedupplayer ) addEventHandler("onClientRender",getRootElement(), WaterOn ) addEventHandler ("onClientRender",getRootElement(),WaterWalk) -- triggerServerEvent ("onSpeedChange", getLocalPlayer(), "fast") -- triggerEvent( "switchRadialBlur", root, true ) end end function outofspeed() speeding = 0 if isTimer(endRun) then killTimer(endRun) endRun = nil end resting = 1 doneresting = setTimer( resetspeedpower, 50, 1 ) removeEventHandler("onClientRender",getRootElement(), speedupplayer ) removeEventHandler("onClientRender",getRootElement(), WaterOn ) removeEventHandler ("onClientRender",getRootElement(),WaterWalk) -- triggerServerEvent ("onSpeedChange", getLocalPlayer(), "normal") -- triggerEvent( "switchRadialBlur", root, false ) end function resetspeedpower() resting = 0 if getControlState("sprint") == true then speedforce( "sprint", "down" ) end end function speedupplayer() if getControlState("sprint") == true then if getControlState("forwards") == true or getControlState("backwards") == true or getControlState("left") == true or getControlState("right") == true then -- setPedWeaponSlot(getLocalPlayer(), 0) local x, y, z = getElementPosition(getLocalPlayer()) local prot = getPedRotation(getLocalPlayer()) local nx, ny = getPointFromDistanceRotation(x, y, 1, (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 task = getPedSimplestTask(getLocalPlayer()) if task == "TASK_SIMPLE_PLAYER_ON_FOOT" 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 elseif task == "TASK_SIMPLE_SWIM" then local level = getWaterLevel ( nx, ny, z ) if level then if getDistanceBetweenPoints3D( x, y, z, nx, ny, level) < 2 then local nx2, ny2 = getPointFromDistanceRotation(x, y, 1, (prot)*-1) local clear = isLineOfSightClear( x, y, z, nx2, ny2, z, true, true, true, true, true, true, true) setElementPosition(getLocalPlayer(), nx, ny, level, false) end end end end end end end end 1 Link to comment
XaskeL Posted May 13, 2019 Share Posted May 13, 2019 addEventHandler("onClientRender",getRootElement(), function() if getPedMoveState(localPlayer) == "sprint" and getKeyState("space") and not localPlayer:getData("brokenbone") then setPedControlState("sprint",not getPedControlState("sprint")) end end) my script from 2015 year. use this in client.lua (clientside script) 1 Link to comment
Scripting Moderators ds1-e Posted May 13, 2019 Author Scripting Moderators Share Posted May 13, 2019 1 hour ago, XaskeL said: addEventHandler("onClientRender",getRootElement(),function() if getPedMoveState(localPlayer) == "sprint" and getKeyState("space") and not localPlayer:getData("brokenbone") then setPedControlState("sprint",not getPedControlState("sprint")) endend) my script from 2015 year. use this in client.lua (clientside script) Thank you very 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