Speed Limit Cruise Control [.Lua] v6
2,259
28
2,259
28
Soft & Buttery Smooth (Speed Limit Based) Cruise Control by JayMontana36
Disclaimer: your game language ***MUST*** be set to English for this to work.
Disclaimer2: V2 and above are apparently incompatible (doesn't work properly or as expected) with "Smooth Driving V" by "Lieutenant Dan", and might not work correctly with other driving or control manipulating/overriding mods (which interfere with this script).
Ever wish that you could better control or limit your vehicle's speed and drive at the speed limit for the road that you're currently on or the area that you're currently in? Ever wish that this could/would be done in a somewhat pretty realistic (and buttery smooth) way/manner rather than instantaneous and abrupt? Ever wish that outside sources or forces (aka gravity and/or some random AI deciding that they would like to ram you in the back) could still cause your vehicle to go beyond the speed/cruise limit? Well hey, here you go lol.
How it works - by default, the toggle button is bound to your "INPUT_VEH_DUCK" button, aka control index 48, the button that you use to duck in/on a vehicle; on controller with the swap handbrake option enabled in your game settings, that button would be X for PlayStation or A for Xbox, on controller with default game settings that button would be R1 for PlayStation or RB for Xbox, on keyboard that button would be X.
This script requires ScriptHookV and JM36 Lua Plugin.
Put "VehicleSpeedLimitCruiseControl.lua" into your JM36 Lua Plugin "ScriptsDir-Lua/Modules" directory.
Put "VehicleSpeedLimitCruiseControl.ini" into your JM36 Lua Plugin "ScriptsDir-Lua" directory (and edit it) if you want to change the keybind to something other than duck.
Changelog:
- v6 - Fixed apparent speed limiter toggle issues/bugs for keyboard players.
- v5 - Implemented forward vehicle speed detection (now responds to vehicles ahead).
- v3 - Improved support on controller with the swap handbrake option enabled in game settings - firing weapons from vehicles on controller no longer toggles cruise in this mode.
Disclaimer: your game language ***MUST*** be set to English for this to work.
Disclaimer2: V2 and above are apparently incompatible (doesn't work properly or as expected) with "Smooth Driving V" by "Lieutenant Dan", and might not work correctly with other driving or control manipulating/overriding mods (which interfere with this script).
Ever wish that you could better control or limit your vehicle's speed and drive at the speed limit for the road that you're currently on or the area that you're currently in? Ever wish that this could/would be done in a somewhat pretty realistic (and buttery smooth) way/manner rather than instantaneous and abrupt? Ever wish that outside sources or forces (aka gravity and/or some random AI deciding that they would like to ram you in the back) could still cause your vehicle to go beyond the speed/cruise limit? Well hey, here you go lol.
How it works - by default, the toggle button is bound to your "INPUT_VEH_DUCK" button, aka control index 48, the button that you use to duck in/on a vehicle; on controller with the swap handbrake option enabled in your game settings, that button would be X for PlayStation or A for Xbox, on controller with default game settings that button would be R1 for PlayStation or RB for Xbox, on keyboard that button would be X.
This script requires ScriptHookV and JM36 Lua Plugin.
Put "VehicleSpeedLimitCruiseControl.lua" into your JM36 Lua Plugin "ScriptsDir-Lua/Modules" directory.
Put "VehicleSpeedLimitCruiseControl.ini" into your JM36 Lua Plugin "ScriptsDir-Lua" directory (and edit it) if you want to change the keybind to something other than duck.
Changelog:
- v6 - Fixed apparent speed limiter toggle issues/bugs for keyboard players.
- v5 - Implemented forward vehicle speed detection (now responds to vehicles ahead).
- v3 - Improved support on controller with the swap handbrake option enabled in game settings - firing weapons from vehicles on controller no longer toggles cruise in this mode.
First Uploaded: May 20, 2022
Last Updated: September 01, 2022
Last Downloaded: 3 days ago
59 Comments
More mods by JayMontana36:
- Lua
- Gtalua
2,093
37
20210909.001
By JayMontana36
- Script Hook
- Developers
- Lua
4.94
60,988
306
ForUsers_JM36-v20230826.0-Stable
By JayMontana36
Soft & Buttery Smooth (Speed Limit Based) Cruise Control by JayMontana36
Disclaimer: your game language ***MUST*** be set to English for this to work.
Disclaimer2: V2 and above are apparently incompatible (doesn't work properly or as expected) with "Smooth Driving V" by "Lieutenant Dan", and might not work correctly with other driving or control manipulating/overriding mods (which interfere with this script).
Ever wish that you could better control or limit your vehicle's speed and drive at the speed limit for the road that you're currently on or the area that you're currently in? Ever wish that this could/would be done in a somewhat pretty realistic (and buttery smooth) way/manner rather than instantaneous and abrupt? Ever wish that outside sources or forces (aka gravity and/or some random AI deciding that they would like to ram you in the back) could still cause your vehicle to go beyond the speed/cruise limit? Well hey, here you go lol.
How it works - by default, the toggle button is bound to your "INPUT_VEH_DUCK" button, aka control index 48, the button that you use to duck in/on a vehicle; on controller with the swap handbrake option enabled in your game settings, that button would be X for PlayStation or A for Xbox, on controller with default game settings that button would be R1 for PlayStation or RB for Xbox, on keyboard that button would be X.
This script requires ScriptHookV and JM36 Lua Plugin.
Put "VehicleSpeedLimitCruiseControl.lua" into your JM36 Lua Plugin "ScriptsDir-Lua/Modules" directory.
Put "VehicleSpeedLimitCruiseControl.ini" into your JM36 Lua Plugin "ScriptsDir-Lua" directory (and edit it) if you want to change the keybind to something other than duck.
Changelog:
- v6 - Fixed apparent speed limiter toggle issues/bugs for keyboard players.
- v5 - Implemented forward vehicle speed detection (now responds to vehicles ahead).
- v3 - Improved support on controller with the swap handbrake option enabled in game settings - firing weapons from vehicles on controller no longer toggles cruise in this mode.
Disclaimer: your game language ***MUST*** be set to English for this to work.
Disclaimer2: V2 and above are apparently incompatible (doesn't work properly or as expected) with "Smooth Driving V" by "Lieutenant Dan", and might not work correctly with other driving or control manipulating/overriding mods (which interfere with this script).
Ever wish that you could better control or limit your vehicle's speed and drive at the speed limit for the road that you're currently on or the area that you're currently in? Ever wish that this could/would be done in a somewhat pretty realistic (and buttery smooth) way/manner rather than instantaneous and abrupt? Ever wish that outside sources or forces (aka gravity and/or some random AI deciding that they would like to ram you in the back) could still cause your vehicle to go beyond the speed/cruise limit? Well hey, here you go lol.
How it works - by default, the toggle button is bound to your "INPUT_VEH_DUCK" button, aka control index 48, the button that you use to duck in/on a vehicle; on controller with the swap handbrake option enabled in your game settings, that button would be X for PlayStation or A for Xbox, on controller with default game settings that button would be R1 for PlayStation or RB for Xbox, on keyboard that button would be X.
This script requires ScriptHookV and JM36 Lua Plugin.
Put "VehicleSpeedLimitCruiseControl.lua" into your JM36 Lua Plugin "ScriptsDir-Lua/Modules" directory.
Put "VehicleSpeedLimitCruiseControl.ini" into your JM36 Lua Plugin "ScriptsDir-Lua" directory (and edit it) if you want to change the keybind to something other than duck.
Changelog:
- v6 - Fixed apparent speed limiter toggle issues/bugs for keyboard players.
- v5 - Implemented forward vehicle speed detection (now responds to vehicles ahead).
- v3 - Improved support on controller with the swap handbrake option enabled in game settings - firing weapons from vehicles on controller no longer toggles cruise in this mode.
First Uploaded: May 20, 2022
Last Updated: September 01, 2022
Last Downloaded: 3 days ago
@cakuzma @AmazyCrazy try the V6 update, hopefully that works for you, I changed the detection/handler for the toggle, and tested out cakuzma's configuration exactly under the new version, and it worked, so it should now work correctly for all keyboard users rather than apparently only controller users; if it doesn't work then I am just at a loss for logic and reason at this point.
@JayMontana36 would need to wait to here from @cakuzma but as for me nothing, could try a diff key bind but I doubt that would change anything, there is a slim chance I could be missing something?
@JayMontana36 so yea, this new update also doesnt work
but its got progress, it shows the true false thing (i added the stuff to show if the keys are working or not)
but when its on true, i can still go over the speed limit
https://i.imgur.com/bFaHK0V.png
@cakuzma So with "LimitSpeed: true" shown, you are still able to accelerate from a full stop and go full speed is what you're saying? Before I pushed the update, I set my ToggleKey to 81 in the ini like you did, and tried driving around on keyboard, and the only time I could accelerate faster than the speed limit with it enabled was when the car ahead was also going faster, otherwise it's limited; going up to full speed and then enabling the limiter afterwards also prevents me from going faster or maintaining that full speed, the vehicle begins to slow down (slowly) and not allow acceleration until I'm at or under the speed limit. What about a video, showing both gameplay and the log?
@AmazyCrazy do you by chance use Smooth Driving V, i just took that mod out as i was useing it, and now this script is working
@JayMontana36 I think i found my issue, I have a script i also use called Smooth Driving V, i think this and that are conflicting
@cakuzma Hmm, probably more than likely yeah, my assumption here is, that mod must also be manipulating or overriding the controls; this script basically blocks (or basically makes the game ignore) your (physical) input while you're over the limit, but that doesn't work at all if a(nother) script is also at the same time detecting and messing with the same input (more than likely force overriding simulating/emulating input); the first version worked in this scenario simply because of the hard entity capping/limit which basically meant that you could go from 200+MPH all the way down to say 15MPH in about 1 second or less. If you want or need, I can possibly redo that and add an ini setting for it, but I'd prefer not to since it kinda goes against "smooth" and "realistic" which was the idea for releases.
@Cakuzma no I don't have that?
@AmazyCrazy what about any other driving mods?
@jayMontana36 Here is a pic of my scripts folder https://www.imagevenue.com/ME15A0Y7?
@AmazyCrazy I see some stuff there that could be driving related, but have no idea any information about them or if they could/would affect/break things; what I do see/notice however, is an apparent mismatch with the "main.lua" file, it's size looks alright but it's date modified timestamp is wrong, and you seem to also have old/legacy Lua Plugin leftovers, which afaik (and as far as I've tested) should never happen, so maybe you've overwritten JM36 Lua Plugin with the old/legacy Lua Plugin, and hence why it wouldn't work (because none of my Lua scripts are compatible with the old/legacy Lua Plugin, while all of the old existing scripts made for that one are fully compatible with my JM36 Lua Plugin)?
@JayMontana36 could you comment me the names of the files in question so I may remove them from my scripts folder and see if that fixes things.
Thanks :)
@AmazyCrazy It *should* automatically get taken care of by JM36 Lua Plugin if correctly installed (and not overwritten by the old/legacy Lua Plugin), but, the "addins" folder, the "libs" folder, the "keys.lua" file, the "utils.lua" file; I don't think removing them will make a difference, because it should just happen automatically as stated.
@JayMontana36 I deleted those files/folders and basically installed a fresh copy of the lua plugin and success the script works :)
@AmazyCrazy Alright cool, so it was indeed because it either wasn't installed correctly or you had the old one which doesn't work with this one (btw to install scripts made for the other one, instead of putting the files in the "addins" you put them in the "Modules" folder)
awesome mod! just one request, can you add an icon/indicator that we can freely move around? :)
@anon23623 What do you mean by that, like a static display indicating enabled/disabled/active/inactive? I have thought about doing so awhile ago, but there exists many other HUDs already (and it may anger people or create conflict to add an indication), and this is simple (and well written) enough to not need an indication as it is either on or off and you can tell if you are unable to accelerate or brake or are moving with no input. If I design my own HUD however, I will consider.
yes something like that, I understand, I just like seeing a visual indicator for my actions, thanks for the consideration :)
I cannot get this to work, and have no idea why it does not. I have gone through the installation instructions for Lua Plugin and this script several times, and it seems everything is where it should be. The scripts directory looks correct, CruiseControl script is in Modules, (not _Modules), ScriptHookV is installed, and Visual C++ Redistributable 2013 installed (and even repaired to be safe). Out of the almost 30 mods I'm running in LSPDFR, this is the only lua script I've attempted to use, and it's the only one that I cannot figure out. I'm sure I'm missing something somewhere, but I don't have the slightest idea where to start looking.
@feedthecreature Are you 100% certain/positive that ScriptHookV is actually being loaded when you're loading RPH? Do other SHV ASI mods work? We can only go from there, maybe you have the directory structure wrong (it should be GTA then scripts then ScriptsDir-Lua then Modules). If you still can't get it, let me know; it might be easier/quicker to talk to me on Discord for help.