Compare commits
2 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
07714e6e63 | |
|
|
dd3a7330d3 |
|
|
@ -30,3 +30,11 @@ I will use this area to keep up with what i did last.
|
||||||
## [Release 1.1.4]
|
## [Release 1.1.4]
|
||||||
|
|
||||||
- Updated logging functions on all scripts and snippets to allow for the new on the fly log change.
|
- Updated logging functions on all scripts and snippets to allow for the new on the fly log change.
|
||||||
|
|
||||||
|
## [Release 1.1.5]
|
||||||
|
- The Christina update
|
||||||
|
- Added in cleaner snippets for SLF and updated templates to match when creating a new resource.
|
||||||
|
|
||||||
|
## [Release 1.1.6]
|
||||||
|
- Updated all resources generated to have new dependencies on SPH and SDB
|
||||||
|
- Updated to new html code for splashscreens
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "cstmgames-fivem-snippets",
|
"name": "cstmgames-fivem-snippets",
|
||||||
"displayName": "CSTMGames FiveM Dev Tools",
|
"displayName": "CSTMGames FiveM Dev Tools",
|
||||||
"description": "Development tools for FiveM",
|
"description": "Development tools for FiveM",
|
||||||
"version": "1.1.4",
|
"version": "1.1.6",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Chase Eller",
|
"name": "Chase Eller",
|
||||||
"email": "chase@cstmgames.com",
|
"email": "chase@cstmgames.com",
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,25 @@
|
||||||
"description": "Sets up basic Log function for use with SLF"
|
"description": "Sets up basic Log function for use with SLF"
|
||||||
},
|
},
|
||||||
"Log to Discord": {
|
"Log to Discord": {
|
||||||
"prefix": "DisLog",
|
"prefix": "DisLogCall",
|
||||||
"body": "DisLog(\"${1:Your Error Text Here}\")$0",
|
"body": "DisLog(\"${1:Your Error Text Here}\")$0",
|
||||||
"description": "SLF Function to log error to Discord."
|
"description": "SLF Function to log error to Discord."
|
||||||
},
|
},
|
||||||
|
"DISLOG FUNCTION": {
|
||||||
|
"prefix": "DISLOG",
|
||||||
|
"body": [
|
||||||
|
"local function DisLog(message)",
|
||||||
|
" 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",
|
||||||
|
" exports.SLF:LogServerToDiscord(RESOURCE_CODE, message)",
|
||||||
|
"end"
|
||||||
|
],
|
||||||
|
"description": "DISLOG FUNCTION"
|
||||||
|
},
|
||||||
"Sets up a basic Citizen Thread for CFX": {
|
"Sets up a basic Citizen Thread for CFX": {
|
||||||
"prefix": "thread",
|
"prefix": "thread",
|
||||||
"body": [
|
"body": [
|
||||||
|
|
@ -42,13 +57,11 @@
|
||||||
"SLF Functions and Vars for server.": {
|
"SLF Functions and Vars for server.": {
|
||||||
"prefix": "SLFSERVER",
|
"prefix": "SLFSERVER",
|
||||||
"body": [
|
"body": [
|
||||||
"--GLOBAL CONSTANTS",
|
"--SLF CONSTANTS",
|
||||||
"local CLASS = \"CHANGEME\"--This is the name that the logging framework will use to display your logs in the correct manner",
|
"local CLASS = \"CHANGEME\"--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 LOG_LEVEL = GetResourceMetadata(GetCurrentResourceName(), \"log_level\", 0)",
|
||||||
"local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), \"resource_code\", 0)",
|
"local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), \"resource_code\", 0)",
|
||||||
"------------------------------------------------------------------------------------------------",
|
"------------------------------------------------------------------------------------------------",
|
||||||
"--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing.",
|
|
||||||
"",
|
|
||||||
"---Used to send logs to the server console",
|
"---Used to send logs to the server console",
|
||||||
"---@param message any Preformatted message or VARIABLES to be sent to log",
|
"---@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",
|
"---@param logLevel integer Level of log, 1-Error, 2-Warn, 3-Info, 4-Debug",
|
||||||
|
|
@ -69,31 +82,22 @@
|
||||||
" end",
|
" end",
|
||||||
"end",
|
"end",
|
||||||
"",
|
"",
|
||||||
"local function DisLog(message)",
|
|
||||||
" 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",
|
|
||||||
" exports.SLF:LogServerToDiscord(RESOURCE_CODE, message)",
|
|
||||||
"end",
|
|
||||||
"RegisterNetEvent(RESOURCE_CODE..\":UpdateLogLevel\")",
|
"RegisterNetEvent(RESOURCE_CODE..\":UpdateLogLevel\")",
|
||||||
"AddEventHandler(RESOURCE_CODE..\":UpdateLogLevel\", function(num)",
|
"AddEventHandler(RESOURCE_CODE..\":UpdateLogLevel\", function(num)",
|
||||||
" LOG_LEVEL = num",
|
" LOG_LEVEL = num",
|
||||||
"end)"
|
"end)",
|
||||||
|
"-----------------------------------------------------------------------------------------------"
|
||||||
],
|
],
|
||||||
"description": "SLF Functions and Vars for server."
|
"description": "SLF Functions and Vars for server."
|
||||||
},
|
},
|
||||||
"SLF Functions and Vars for client.": {
|
"SLF Functions and Vars for client.": {
|
||||||
"prefix": "SLFCLIENT",
|
"prefix": "SLFCLIENT",
|
||||||
"body": [
|
"body": [
|
||||||
"--GLOBAL CONSTANTS",
|
"--SLF CONSTANTS",
|
||||||
"local CLASS = \"CHANGEME\"--This is the name that the logging framework will use to display your logs in the correct manner",
|
"local CLASS = \"CHANGEME\"--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 LOG_LEVEL = GetResourceMetadata(GetCurrentResourceName(), \"log_level\", 0)",
|
||||||
"local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), \"resource_code\", 0)",
|
"local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), \"resource_code\", 0)",
|
||||||
"-----------------------------------------------------------------------------------------------",
|
"-----------------------------------------------------------------------------------------------",
|
||||||
"--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing",
|
|
||||||
"---Used to send logs to the client console",
|
"---Used to send logs to the client console",
|
||||||
"---@param message any Preformatted message or VARIABLES to be sent to log",
|
"---@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",
|
"---@param logLevel integer Level of log, 1-Error, 2-Warn, 3-Info, 4-Debug",
|
||||||
|
|
@ -113,10 +117,12 @@
|
||||||
" Log(\"Warning line was logged without a level value... Logged it as debug as that is the safest route.\", 1)",
|
" Log(\"Warning line was logged without a level value... Logged it as debug as that is the safest route.\", 1)",
|
||||||
" end",
|
" end",
|
||||||
"end",
|
"end",
|
||||||
|
"",
|
||||||
"RegisterNetEvent(RESOURCE_CODE..\":UpdateLogLevel\")",
|
"RegisterNetEvent(RESOURCE_CODE..\":UpdateLogLevel\")",
|
||||||
"AddEventHandler(RESOURCE_CODE..\":UpdateLogLevel\", function(num)",
|
"AddEventHandler(RESOURCE_CODE..\":UpdateLogLevel\", function(num)",
|
||||||
" LOG_LEVEL = num",
|
" LOG_LEVEL = num",
|
||||||
"end)"
|
"end)",
|
||||||
|
"-----------------------------------------------------------------------------------------------"
|
||||||
],
|
],
|
||||||
"description": "SLF Functions and Vars for client."
|
"description": "SLF Functions and Vars for client."
|
||||||
},
|
},
|
||||||
|
|
@ -212,5 +218,35 @@
|
||||||
"end)"
|
"end)"
|
||||||
],
|
],
|
||||||
"description": "Thread Net Register"
|
"description": "Thread Net Register"
|
||||||
|
},
|
||||||
|
"Coding Regions": {
|
||||||
|
"prefix": "regions",
|
||||||
|
"body": [
|
||||||
|
"--CONSTANTS--",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"--VARIABLES--",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"--FUNCTIONS--",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"--THREADS--",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"--NET EVENTS--",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"--COMMANDS--",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"description": "Coding Regions"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
--GLOBAL CONSTANTS
|
--SLF CONSTANTS
|
||||||
local CLASS = "CHANGEME"--This is the name that the logging framework will use to display your logs in the correct manner
|
local CLASS = "CHANGEME"--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 LOG_LEVEL = GetResourceMetadata(GetCurrentResourceName(), "log_level", 0)
|
||||||
local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_code", 0)
|
local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_code", 0)
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing
|
|
||||||
---Used to send logs to the client console
|
---Used to send logs to the client console
|
||||||
---@param message any Preformatted message or VARIABLES to be sent to log
|
---@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
|
---@param logLevel integer Level of log, 1-Error, 2-Warn, 3-Info, 4-Debug
|
||||||
|
|
@ -23,24 +22,32 @@ local function Log(message, logLevel)
|
||||||
Log("Warning line was logged without a level value... Logged it as debug as that is the safest route.", 1)
|
Log("Warning line was logged without a level value... Logged it as debug as that is the safest route.", 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
RegisterNetEvent(RESOURCE_CODE..":UpdateLogLevel")
|
RegisterNetEvent(RESOURCE_CODE..":UpdateLogLevel")
|
||||||
AddEventHandler(RESOURCE_CODE..":UpdateLogLevel", function(num)
|
AddEventHandler(RESOURCE_CODE..":UpdateLogLevel", function(num)
|
||||||
LOG_LEVEL = num
|
LOG_LEVEL = num
|
||||||
end)
|
end)
|
||||||
--LOCAL VARIABLES
|
|
||||||
|
|
||||||
--END CONFIG
|
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
|
--CONSTANTS--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-------------------
|
--VARIABLES--
|
||||||
--YOUR CODE HERE---
|
|
||||||
--HAPPY CODING!----
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--FUNCTIONS--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--THREADS--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--NET EVENTS--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--COMMANDS--
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,9 @@ bucket_prefix '9'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
'SLF',
|
'SLF',
|
||||||
'SCF'
|
'SCF',
|
||||||
|
'SDB',
|
||||||
|
'SPH'
|
||||||
}
|
}
|
||||||
|
|
||||||
files {
|
files {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
--GLOBAL CONSTANTS
|
--SLF CONSTANTS
|
||||||
local CLASS = "CHANGEME"--This is the name that the logging framework will use to display your logs in the correct manner
|
local CLASS = "CHANGEME"--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 LOG_LEVEL = GetResourceMetadata(GetCurrentResourceName(), "log_level", 0)
|
||||||
local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_code", 0)
|
local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_code", 0)
|
||||||
------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------
|
||||||
--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing.
|
|
||||||
|
|
||||||
---Used to send logs to the server console
|
---Used to send logs to the server console
|
||||||
---@param message any Preformatted message or VARIABLES to be sent to log
|
---@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
|
---@param logLevel integer Level of log, 1-Error, 2-Warn, 3-Info, 4-Debug
|
||||||
|
|
@ -25,34 +23,31 @@ local function Log(message, logLevel)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function DisLog(message)
|
|
||||||
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
|
|
||||||
exports.SLF:LogServerToDiscord(RESOURCE_CODE, message)
|
|
||||||
end
|
|
||||||
|
|
||||||
RegisterNetEvent(RESOURCE_CODE..":UpdateLogLevel")
|
RegisterNetEvent(RESOURCE_CODE..":UpdateLogLevel")
|
||||||
AddEventHandler(RESOURCE_CODE..":UpdateLogLevel", function(num)
|
AddEventHandler(RESOURCE_CODE..":UpdateLogLevel", function(num)
|
||||||
LOG_LEVEL = num
|
LOG_LEVEL = num
|
||||||
end)
|
end)
|
||||||
--Global Variables
|
------------------------------------------------------------------------------------------------
|
||||||
|
--CONSTANTS--
|
||||||
--LOCAL VARIABLES
|
|
||||||
|
|
||||||
|
|
||||||
--END CONFIG
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-------------------
|
--VARIABLES--
|
||||||
--YOUR CODE HERE---
|
|
||||||
--HAPPY CODING!----
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--FUNCTIONS--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--THREADS--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--NET EVENTS--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--COMMANDS--
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
--GLOBAL CONSTANTS
|
--SLF CONSTANTS
|
||||||
local CLASS = "CHANGEME"--This is the name that the logging framework will use to display your logs in the correct manner
|
local CLASS = "CHANGEME"--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 LOG_LEVEL = GetResourceMetadata(GetCurrentResourceName(), "log_level", 0)
|
||||||
local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_code", 0)
|
local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_code", 0)
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing
|
|
||||||
---Used to send logs to the client console
|
---Used to send logs to the client console
|
||||||
---@param message any Preformatted message or VARIABLES to be sent to log
|
---@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
|
---@param logLevel integer Level of log, 1-Error, 2-Warn, 3-Info, 4-Debug
|
||||||
|
|
@ -23,25 +22,32 @@ local function Log(message, logLevel)
|
||||||
Log("Warning line was logged without a level value... Logged it as debug as that is the safest route.", 1)
|
Log("Warning line was logged without a level value... Logged it as debug as that is the safest route.", 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
RegisterNetEvent(RESOURCE_CODE..":UpdateLogLevel")
|
RegisterNetEvent(RESOURCE_CODE..":UpdateLogLevel")
|
||||||
AddEventHandler(RESOURCE_CODE..":UpdateLogLevel", function(num)
|
AddEventHandler(RESOURCE_CODE..":UpdateLogLevel", function(num)
|
||||||
LOG_LEVEL = num
|
LOG_LEVEL = num
|
||||||
end)
|
end)
|
||||||
|
|
||||||
--LOCAL VARIABLES
|
|
||||||
|
|
||||||
--END CONFIG
|
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
|
--CONSTANTS--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-------------------
|
--VARIABLES--
|
||||||
--YOUR CODE HERE---
|
|
||||||
--HAPPY CODING!----
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--FUNCTIONS--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--THREADS--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--NET EVENTS--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--COMMANDS--
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1,38 +1,97 @@
|
||||||
|
--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)
|
local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_code", 0)
|
||||||
local SPLASH_IMG = GetResourceMetadata(GetCurrentResourceName(), "SPLASH_IMG", 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
|
||||||
|
|
||||||
--Setup the splash image on script load
|
RegisterNetEvent(RESOURCE_CODE..":UpdateLogLevel")
|
||||||
Citizen.CreateThread(function()
|
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")
|
print("Setting Up LoadSplash")
|
||||||
SendNUIMessage({
|
SendNUIMessage({
|
||||||
type = "setIMG",
|
type = "setIMG",
|
||||||
value = SPLASH_IMG,
|
value = image
|
||||||
})
|
})
|
||||||
end)
|
end
|
||||||
|
|
||||||
-- Show and hide the splash without spinner
|
local function DisplaySplash(bool)
|
||||||
function displaySplash(bool)
|
|
||||||
SendNUIMessage({
|
SendNUIMessage({
|
||||||
type = "showSplash",
|
type = "showSplash",
|
||||||
status = bool,
|
status = bool
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
RegisterNetEvent(RESOURCE_CODE..':ShowStaticSplash')
|
local function DisplayLoadSplash(bool)
|
||||||
AddEventHandler(RESOURCE_CODE..':ShowStaticSplash', function(bool)
|
|
||||||
displaySplash(bool)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Show and hide the splash with spinner
|
|
||||||
function displayLoadSplash(bool)
|
|
||||||
SendNUIMessage({
|
SendNUIMessage({
|
||||||
type = "showLoadingSplash",
|
type = "showLoadingSplash",
|
||||||
status = bool,
|
status = bool
|
||||||
})
|
})
|
||||||
end
|
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')
|
RegisterNetEvent(RESOURCE_CODE..':ShowLoadingSplash')
|
||||||
AddEventHandler(RESOURCE_CODE..':ShowLoadingSplash', function(bool)
|
AddEventHandler(RESOURCE_CODE..':ShowLoadingSplash', function(bool)
|
||||||
displayLoadSplash(bool)
|
Log("Displaying or Hiding Loading Splash Screen", 4)
|
||||||
|
DisplayLoadSplash(bool)
|
||||||
end)
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,9 @@ SPLASH_IMG 'https://images.cstm.games/imgstor/splashscreens/defaultsplash.png'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
'SLF',
|
'SLF',
|
||||||
'SCF'
|
'SCF',
|
||||||
|
'SDB',
|
||||||
|
'SPH'
|
||||||
}
|
}
|
||||||
|
|
||||||
files {
|
files {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
--GLOBAL CONSTANTS
|
--SLF CONSTANTS
|
||||||
local CLASS = "CHANGEME"--This is the name that the logging framework will use to display your logs in the correct manner
|
local CLASS = "CHANGEME"--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 LOG_LEVEL = GetResourceMetadata(GetCurrentResourceName(), "log_level", 0)
|
||||||
local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_code", 0)
|
local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_code", 0)
|
||||||
------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------
|
||||||
--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing.
|
|
||||||
|
|
||||||
---Used to send logs to the server console
|
---Used to send logs to the server console
|
||||||
---@param message any Preformatted message or VARIABLES to be sent to log
|
---@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
|
---@param logLevel integer Level of log, 1-Error, 2-Warn, 3-Info, 4-Debug
|
||||||
|
|
@ -25,33 +23,31 @@ local function Log(message, logLevel)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function DisLog(message)
|
|
||||||
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
|
|
||||||
exports.SLF:LogServerToDiscord(RESOURCE_CODE, message)
|
|
||||||
end
|
|
||||||
RegisterNetEvent(RESOURCE_CODE..":UpdateLogLevel")
|
RegisterNetEvent(RESOURCE_CODE..":UpdateLogLevel")
|
||||||
AddEventHandler(RESOURCE_CODE..":UpdateLogLevel", function(num)
|
AddEventHandler(RESOURCE_CODE..":UpdateLogLevel", function(num)
|
||||||
LOG_LEVEL = num
|
LOG_LEVEL = num
|
||||||
end)
|
end)
|
||||||
--Global Variables
|
------------------------------------------------------------------------------------------------
|
||||||
|
--CONSTANTS--
|
||||||
--LOCAL VARIABLES
|
|
||||||
|
|
||||||
|
|
||||||
--END CONFIG
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-------------------
|
--VARIABLES--
|
||||||
--YOUR CODE HERE---
|
|
||||||
--HAPPY CODING!----
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--FUNCTIONS--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--THREADS--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--NET EVENTS--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--COMMANDS--
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue