iNsanex Posted June 10, 2012 Share Posted June 10, 2012 Well i was told there's a way to disable the CJ run built into MTA to make the running/sprinting like S*MP How do I do this? I've looked into a few methods, setting the game speed etc but it hasn't worked right Link to comment
Castillo Posted June 10, 2012 Share Posted June 10, 2012 I don't understand what do you mean, you want to stop the player from running? if so you can use toggleControl. Link to comment
Cyandie Posted June 10, 2012 Share Posted June 10, 2012 He means like stop when you normally run you can change it to walk as a ped like in samp so not the CJ walking ped anim. Link to comment
iNsanex Posted June 10, 2012 Author Share Posted June 10, 2012 CJ walking is faster sprinting in samp the sprint speed is quite a bit slower, I've discovered the MTA sprint speed is 35 KM/h when you tap space bar repeatedly, on samp its around 21 KM/h if i had to guess, I'd like to lower the speed you sprint at when you tap space bar , CJ run is the term used for it, a common SAMP hack because in single player CJ ran faster then any other ped. Link to comment
DiSaMe Posted June 10, 2012 Share Posted June 10, 2012 bindKey getControlState setPedAnimation Link to comment
BinSlayer1 Posted June 10, 2012 Share Posted June 10, 2012 Clientside.. onClientRender, check if local player speed is more than 21 km/h If it is, set the element speed of the local player to 21. https://wiki.multitheftauto.com/wiki/SetElementSpeed https://wiki.multitheftauto.com/wiki/GetElementSpeed Link to comment
Alex. Posted June 10, 2012 Share Posted June 10, 2012 Clientside..onClientRender, check if local player speed is more than 21 km/h If it is, set the element speed of the local player to 21. https://wiki.multitheftauto.com/wiki/SetElementSpeed https://wiki.multitheftauto.com/wiki/GetElementSpeed Don't forget to add a check whether the player is in a vehicle or not using: https://wiki.multitheftauto.com/wiki/IsPedInVehicle Link to comment
Al3grab Posted June 10, 2012 Share Posted June 10, 2012 there is no need for all those functions -- Client toggleControl("sprint",false) Link to comment
BinSlayer1 Posted June 10, 2012 Share Posted June 10, 2012 there is no need for all those functions -- Client toggleControl("sprint",false) rofl, he doesn't want to disable sprinting.. But he believes MTA sprinting is faster than SA-MP sprinting so he wants to alter the maximum sprint speed of the player. Link to comment
Al3grab Posted June 10, 2012 Share Posted June 10, 2012 there is no need for all those functions -- Client toggleControl("sprint",false) rofl, he doesn't want to disable sprinting.. But he believes MTA sprinting is faster than SA-MP sprinting so he wants to alter the maximum sprint speed of the player. the topic name is 'Disable CJ run' Link to comment
Alex. Posted June 10, 2012 Share Posted June 10, 2012 there is no need for all those functions -- Client toggleControl("sprint",false) rofl, he doesn't want to disable sprinting.. But he believes MTA sprinting is faster than SA-MP sprinting so he wants to alter the maximum sprint speed of the player. the topic name is 'Disable CJ run' CJ walking is faster sprinting in samp the sprint speed is quite a bit slower, I've discovered the MTA sprint speed is 35 KM/h when you tap space bar repeatedly, on samp its around 21 KM/h if i had to guess, I'd like to lower the speed you sprint at when you tap space bar , CJ run is the term used for it, a common SAMP hack because in single player CJ ran faster then any other ped. Link to comment
Al3grab Posted June 10, 2012 Share Posted June 10, 2012 oh , then .. function setElementSpeed(element, unit, speed) -- only work if element is moving! if (unit == nil) then unit = 0 end if (speed == nil) then speed = 0 end speed = tonumber(speed) local acSpeed = getElementSpeed(element, unit) if (acSpeed~=false) then -- if true - element is valid, no need to check again local diff = speed/acSpeed local x,y,z = getElementVelocity(element) setElementVelocity(element,x*diff,y*diff,z*diff) return true end return false end function getElementSpeed(element,unit) if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.61 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end addEventHandler("onClientRender",root,function() local speed = getElementSpeed(localPlayer,"mph") if ( speed and speed > 21 and getControlState("sprint") == true ) then setElementSpeed(localPlayer,"mph",21) end end ) Link to comment
Alex. Posted June 10, 2012 Share Posted June 10, 2012 oh , then .. function setElementSpeed(element, unit, speed) -- only work if element is moving! if (unit == nil) then unit = 0 end if (speed == nil) then speed = 0 end speed = tonumber(speed) local acSpeed = getElementSpeed(element, unit) if (acSpeed~=false) then -- if true - element is valid, no need to check again local diff = speed/acSpeed local x,y,z = getElementVelocity(element) setElementVelocity(element,x*diff,y*diff,z*diff) return true end return false end function getElementSpeed(element,unit) if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.61 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end addEventHandler("onClientRender",root,function() local speed = getElementSpeed(localPlayer,"mph") if ( speed and speed > 21 and getControlState("sprint") == true ) then setElementSpeed(localPlayer,"mph",21) end end ) Wrong unit, and why do you provide him the code? It's a lot better if he would try himself rather than just being given the code. 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