RP Friendly Cruise Control and Speed Limiter

RP Friendly Cruise Control/Speed Limiter


This is new iteration of Cruise Control/Speed Limiting, that I’ve had good feedback on compared to other Cruise Control/Speed limiter scripts.

You can configure what cars have cruise control in the config, other cars have just speed limiter - you must hold W key to drive.

Speed limiter

Compared to other speed limiter script I’ve tried, this one controls the engine RPM so that the engine does not overrev in lower speeds. With this script you can easily cruise at lower speeds with speed limiter. When setting the speed limit the car DOES NOT suddenly slow down but instead it applies breaks until wanted speed is reached.

Cruise control

The cruise control, compared to other scripts, works by applying ideal pedal pressure to reach and maintain wanted speed. The script also lets off the gas when steering to have more control over the car in turns.

Control

By default, you open Cruise Control menu by pressing F7. You can configure the key or wether or not it even is controlable by key in config. You can just as well integrate this script into your system and control the speed limiter/cruise control with event API.

Config

In config.lua you can set if you want to use KM/H or MPH with

  • Mode = MODE_MPH or Mode = MODE_KMH

  • You can configure the speeds in default menu in Speeds table

  • You can translate the resource in the Text table

  • You can add or remove vehicles in the CruiseControlWhitelist table

API

  • TriggerEvent('teb_speed_control:setCruiseControl', speed)

Sets the cruise control to wanted speed. KM/H or MPH is configured in Config.lua

  • TriggerEvent('teb_speed_control:setSpeedLimiter', speed)

Sets the speed limiter to wanted speed. KM/H or MPH is configured in Config.lua

  • TriggerEvent('teb_speed_control:stop')

Stops cruise control AND speed limiter


Source: https://github.com/hojgr/teb_speed_control

teb_speed_control.zip (8.1 KB)

5 Likes

screenshots?

added screenshot. its not very visual script as it just controls vehicle speed :smiley:

I feel like it would be better to have a blacklist rather than a whitelist. Then again its a simple ! near the if statement. :stuck_out_tongue:

Quality resources for the public, quality work from you as always. :ok_hand:

Quality resource! Thanks.

Quality script. Only thought is to allow the whitelisted cars to be able to enable cruise control or speed limiter.

The menu opens and I’ve set it to KMH in the config, but its not limiting speed, I’ve been using the first car in the config list as a test for it. Any ideas on a fix?

I would like to use that for police vehicles and so on

maybe someone knows how to do that

Hello and thank you for your good script. How can I set a specific speed in the radial menu according to the config file settings? For example, I have a speed of 140 km / h in the config file and I want to set this speed limit in radial as a command so that players can limit the speed of their vehicle to 140 km by selecting this option. Thankful :ok_hand:

is there a way to use rpm limiter outside of your script, because, when i try this line local diff = CurrentMaxSpeedMetersPerSecond - curSpeed, i get attempt to perform arithmetic on a nil value (local ‘CurrentMaxSpeedMetersPerSecond’)

How can i import the Speed Limiter into krz_personalmenu?