Jump to content

Custom vehicle acceleration


PSoma

Recommended Posts

Posted

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?

Posted
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

  • Like 1
Posted
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.

Posted (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 by Shady1
  • Like 1
Posted
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.

Posted
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

  • Like 1
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...