This repository has been archived on 2026-03-25. You can view files and clone it, but cannot push or open issues or pull requests.
ResourceGeneratorPlugin/template/client/nui.lua

39 lines
953 B
Lua

local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_code", 0)
local SPLASH_IMG = GetResourceMetadata(GetCurrentResourceName(), "SPLASH_IMG", 0)
--Setup the splash image on script load
Citizen.CreateThread(function()
print("Setting Up LoadSplash")
SendNUIMessage({
type = "setIMG",
value = SPLASH_IMG,
})
end)
-- Show and hide the splash without spinner
function displaySplash(bool)
SendNUIMessage({
type = "showSplash",
status = bool,
})
end
RegisterNetEvent(RESOURCE_CODE..':ShowStaticSplash')
AddEventHandler(RESOURCE_CODE..':ShowStaticSplash', function(bool)
displaySplash(bool)
end)
-- Show and hide the splash with spinner
function displayLoadSplash(bool)
SendNUIMessage({
type = "showLoadingSplash",
status = bool,
})
end
RegisterNetEvent(RESOURCE_CODE..':ShowLoadingSplash')
AddEventHandler(RESOURCE_CODE..':ShowLoadingSplash', function(bool)
displayLoadSplash(bool)
end)