From cc89d4c72ad60baaafcb74354adaca578775542d Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 7 Jan 2021 10:52:30 +0000 Subject: [PATCH] Fixed UI settings not reloading on resource restart --- cl_radar.lua | 8 +++++--- cl_utils.lua | 4 +--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cl_radar.lua b/cl_radar.lua index a3e140c..b8a04c2 100644 --- a/cl_radar.lua +++ b/cl_radar.lua @@ -144,10 +144,12 @@ end ) -- default settings applied AddEventHandler( "onResourceStart", function( resourceName ) if ( GetCurrentResourceName() == resourceName ) then - Citizen.Wait( 2000 ) + Citizen.CreateThread( function() + Citizen.Wait( 1000 ) - RegisterKeyBinds() - LoadUISettings() + RegisterKeyBinds() + LoadUISettings() + end ) end end ) diff --git a/cl_utils.lua b/cl_utils.lua index 385ea54..f30bc27 100644 --- a/cl_utils.lua +++ b/cl_utils.lua @@ -31,7 +31,6 @@ ---------------------------------------------------------------------------------------]]-- UTIL = {} -UTIL.resourceName = "" -- Returns a number to a set number of decimal places function UTIL:Round( num, numDecimalPlaces ) @@ -150,9 +149,8 @@ function UTIL:DrawDebugText( x, y, scale, centre, text ) DrawText( x, y ) end -Citizen.CreateThread( function() UTIL.resourceName = GetCurrentResourceName() end ) function UTIL:IsResourceNameValid() - return self.resourceName == "wk_wars2x" + return GetCurrentResourceName() == "wk_wars2x" end --[[The MIT License (MIT)