fix: fast limit settings not saving

This commit is contained in:
Dan
2021-03-17 16:59:50 +00:00
parent 040141f4c8
commit 7e63c37e45
2 changed files with 19 additions and 9 deletions

View File

@@ -207,7 +207,13 @@ RADAR.vars =
["plateAudio"] = CONFIG.menuDefaults["plateAudio"], ["plateAudio"] = CONFIG.menuDefaults["plateAudio"],
-- The speed unit used in conversions -- 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 -- 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 ) table.insert( fastOptions[2].options, i )
end 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 -- Add the fast options to the main menu options table
table.insert( self.vars.menuOptions, fastOptions[1] ) table.insert( self.vars.menuOptions, fastOptions[1] )
table.insert( self.vars.menuOptions, fastOptions[2] ) 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 -- Update the end coordinates for the ray traces based on the config, again, reduced hard coding
RADAR:UpdateRayEndCoords() 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 the fast limit feature is allowed, create the config in the radar variables
if ( RADAR:IsFastLimitAllowed() ) then if ( RADAR:IsFastLimitAllowed() ) then
RADAR:CreateFastLimitConfig() RADAR:CreateFastLimitConfig()
end end
-- Update the operator menu positions
RADAR:UpdateOptionIndexes( true )
-- Run the main radar function -- Run the main radar function
while ( true ) do while ( true ) do
RADAR:Main() RADAR:Main()

View File

@@ -112,7 +112,15 @@ CONFIG.menuDefaults =
-- The speed unit used in conversions -- The speed unit used in conversions
-- Options: mph or kmh -- 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 -- Here you can change the default scale of the UI elements, as well as the safezone size