--SLF CONSTANTS local CLASS = "GFMS_NUI"--This is the name that the logging framework will use to display your logs in the correct manner local LOG_LEVEL = GetResourceMetadata(GetCurrentResourceName(), "log_level", 0) local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_code", 0) ----------------------------------------------------------------------------------------------- ---Used to send logs to the client console ---@param message any Preformatted message or VARIABLES to be sent to log ---@param logLevel integer Level of log, 1-Error, 2-Warn, 3-Info, 4-Debug local function Log(message, logLevel) local line = debug.getinfo(2, "l").currentline local name = debug.getinfo(2, "n").name if name == "fn" then name = "Thread" end local value = "{"..CLASS.."."..name.."("..line..")} "..message if logLevel then if tonumber(LOG_LEVEL) >= logLevel then exports.SLF:LogToClient(RESOURCE_CODE, logLevel, value) end else exports.SLF:LogToClient(RESOURCE_CODE, 4, value) Log("Warning line was logged without a level value... Logged it as debug as that is the safest route.", 1) end end RegisterNetEvent(RESOURCE_CODE..":UpdateLogLevel") AddEventHandler(RESOURCE_CODE..":UpdateLogLevel", function(num) LOG_LEVEL = num end) ----------------------------------------------------------------------------------------------- --CONSTANTS-- --VARIABLES-- GFMS_SPLASH_IMG = GetResourceMetadata(GetCurrentResourceName(), "SPLASH_IMG", 0) --FUNCTIONS-- local function ChangeImage(image) print("Setting Up LoadSplash") SendNUIMessage({ type = "setIMG", value = image }) end local function DisplaySplash(bool) SendNUIMessage({ type = "showSplash", status = bool }) end local function DisplayLoadSplash(bool) SendNUIMessage({ type = "showLoadingSplash", status = bool }) end --THREADS-- Citizen.CreateThread(function() ChangeImage(GFMS_SPLASH_IMG) end) --NET EVENTS-- RegisterNetEvent(RESOURCE_CODE..':ShowStaticSplash') AddEventHandler(RESOURCE_CODE..':ShowStaticSplash', function(bool) Log("Displaying or Hiding Static Splash Screen", 4) DisplaySplash(bool) end) RegisterNetEvent(RESOURCE_CODE..':ShowLoadingSplash') AddEventHandler(RESOURCE_CODE..':ShowLoadingSplash', function(bool) Log("Displaying or Hiding Loading Splash Screen", 4) DisplayLoadSplash(bool) end) RegisterNetEvent(RESOURCE_CODE..":ChangeImage") AddEventHandler(RESOURCE_CODE..":ChangeImage", function(image) Log("Changing Splash Image", 4) ChangeImage(image) end) --COMMANDS-- --Setup the splash image on script load -- Show and hide the splash without spinner