PSoma Posted January 30, 2023 Posted January 30, 2023 Hello, I would like to make a custom vehicle acceleration script. My script looks like something like this. addEventHandler("onClientRender", root, function() setAnalogControlState("accelerate", a) end) addEventHandler("onClientResourceStart", resourceRoot, function() toggleControl("accelerate", false) end) I would like to disable the WASD keys. I disabled the acceleration by the toggleControl() function. The problem is that, it disabled the setAnalogControlState() function too. Is there any way to disable the vehicle acceleration key?
Shady1 Posted January 30, 2023 Posted January 30, 2023 1 hour ago, PSoma said: Hello, I would like to make a custom vehicle acceleration script. My script looks like something like this. addEventHandler("onClientRender", root, function() setAnalogControlState("accelerate", a) end) addEventHandler("onClientResourceStart", resourceRoot, function() toggleControl("accelerate", false) end) I would like to disable the WASD keys. I disabled the acceleration by the toggleControl() function. The problem is that, it disabled the setAnalogControlState() function too. Is there any way to disable the vehicle acceleration key? hello welcome to the forum i will post a link about your problem, i hope it helps you, have a nice day https://wiki.multitheftauto.com/wiki/SetPedControlState 1
PSoma Posted January 30, 2023 Author Posted January 30, 2023 6 minutes ago, Shady1 said: hello welcome to the forum i will post a link about your problem, i hope it helps you, have a nice day https://wiki.multitheftauto.com/wiki/SetPedControlState Hello, thank you for replying. The setPedControlState() has only only two state. I would like to accelerate the vehicle smoothly. For that I need a method like setAnalogControlState() where I can set the value as float.
Shady1 Posted January 30, 2023 Posted January 30, 2023 (edited) hello, I tested your code, I couldn't see any problem, only the car was active to go back, I turned it off, everything works addEventHandler("onClientRender", root, function() setAnalogControlState("accelerate", 0.1) end) addEventHandler("onClientResourceStart", resourceRoot, function() toggleControl("accelerate", false) toggleControl("brake_reverse", false) end) 26 minutes ago, PSoma said: Hello, thank you for replying. The setPedControlState() has only only two state. I would like to accelerate the vehicle smoothly. For that I need a method like setAnalogControlState() where I can set the value as float. ths Edited January 30, 2023 by Shady1 1
PSoma Posted January 30, 2023 Author Posted January 30, 2023 1 hour ago, Shady1 said: hello, I tested your code, I couldn't see any problem, only the car was active to go back, I turned it off, everything works addEventHandler("onClientRender", root, function() setAnalogControlState("accelerate", 0.1) end) addEventHandler("onClientResourceStart", resourceRoot, function() toggleControl("accelerate", false) toggleControl("brake_reverse", false) end) ths You right, I missed something in my original code. It's working now.
Shady1 Posted January 30, 2023 Posted January 30, 2023 8 minutes ago, PSoma said: You right, I missed something in my original code. It's working now. I'm glad your problem is fixed, if you like my help, you can like it in the comment 1
Human Resources Staff Vinyard Posted January 30, 2023 Human Resources Staff Posted January 30, 2023 Closing this as resolved.
Recommended Posts