From 7e63c37e452f1baa95c50b69ee07033968cdb840 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 17 Mar 2021 16:59:50 +0000 Subject: [PATCH] fix: fast limit settings not saving --- cl_radar.lua | 18 ++++++++++-------- config.lua | 10 +++++++++- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/cl_radar.lua b/cl_radar.lua index 998a7ea..a3d3e0f 100644 --- a/cl_radar.lua +++ b/cl_radar.lua @@ -207,7 +207,13 @@ RADAR.vars = ["plateAudio"] = CONFIG.menuDefaults["plateAudio"], -- The speed unit used in conversions - ["speedType"] = CONFIG.menuDefaults["speedType"] + ["speedType"] = CONFIG.menuDefaults["speedType"], + + -- The state of automatic speed locking + ["fastLock"] = CONFIG.menuDefaults["fastLock"], + + -- The speed limit for automatic speed locking + ["fastLimit"] = CONFIG.menuDefaults["fastLimit"] }, -- These 3 variables are for the in-radar menu that can be accessed through the remote control, the menuOptions table @@ -540,10 +546,6 @@ if ( RADAR:IsFastLimitAllowed() ) then table.insert( fastOptions[2].options, i ) end - -- Create the settings with the default options - self:SetSettingValue( "fastLock", false ) - self:SetSettingValue( "fastLimit", 60 ) - -- Add the fast options to the main menu options table table.insert( self.vars.menuOptions, fastOptions[1] ) table.insert( self.vars.menuOptions, fastOptions[2] ) @@ -1874,14 +1876,14 @@ Citizen.CreateThread( function() -- Update the end coordinates for the ray traces based on the config, again, reduced hard coding RADAR:UpdateRayEndCoords() - -- Update the operator menu positions - RADAR:UpdateOptionIndexes( true ) - -- If the fast limit feature is allowed, create the config in the radar variables if ( RADAR:IsFastLimitAllowed() ) then RADAR:CreateFastLimitConfig() end + -- Update the operator menu positions + RADAR:UpdateOptionIndexes( true ) + -- Run the main radar function while ( true ) do RADAR:Main() diff --git a/config.lua b/config.lua index 6d0de37..2bc813a 100644 --- a/config.lua +++ b/config.lua @@ -112,7 +112,15 @@ CONFIG.menuDefaults = -- The speed unit used in conversions -- Options: mph or kmh - ["speedType"] = "mph" + ["speedType"] = "mph", + + -- The state for automatic speed locking. This requires CONFIG.allow_fast_limit to be true. + -- Options: true or false + ["fastLock"] = false, + + -- The speed limit required for automatic speed locking. This requires CONFIG.allow_fast_limit to be true. + -- Options: 0 to 200 + ["fastLimit"] = 60 } -- Here you can change the default scale of the UI elements, as well as the safezone size