Coding Update
Build & Release VS Code Extension / release (push) Successful in 18s Details

- Updated snippets for SLF to align with new coding processes
- Updated templates for resource builder to build to new coding process
This commit is contained in:
Chase Eller 2026-03-24 21:55:24 -04:00
parent 659ef72d68
commit 8252d42b6a
No known key found for this signature in database
GPG Key ID: 9233D42F495E657C
7 changed files with 130 additions and 119 deletions

View File

@ -20,4 +20,9 @@ I will use this area to keep up with what i did last.
## [Release 1.1.2] ## [Release 1.1.2]
- Combined the 2 dev tool resources togethter to make one total tool for easier maintaining - Combined the 2 dev tool resources togethter to make one total tool for easier maintaining
## [Release 1.1.3]
- Updated snippets for SLF to align with new coding processes
- Updated templates for resource builder to build to new coding process

View File

@ -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.2", "version": "1.1.3",
"author": { "author": {
"name": "Chase Eller", "name": "Chase Eller",
"email": "chase@cstmgames.com", "email": "chase@cstmgames.com",

View File

@ -1,13 +1,4 @@
{ {
"Setup SLF Vars": {
"prefix": "SLFVARS",
"body": [
"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 RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), \"resource_code\", 0)"
],
"description": ""
},
"Log to SLF": { "Log to SLF": {
"prefix": "Log", "prefix": "Log",
"body": "Log(\"${1:Your Log Message Here}\", ${2|4,3,2,1|})$0", "body": "Log(\"${1:Your Log Message Here}\", ${2|4,3,2,1|})$0",
@ -48,39 +39,78 @@
], ],
"description": "Sets up command to be registered" "description": "Sets up command to be registered"
}, },
"Server Side SLF Function": { "SLF Functions and Vars for SERVER.": {
"prefix": "slfserver", "prefix": "SLFSERVER",
"body": [ "body": [
"function Log(message, logLevel)", "--GLOBAL CONSTANTS",
"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 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",
"---@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 line = debug.getinfo(2, \"l\").currentline",
" local name = debug.getinfo(2, \"n\").name", " local name = debug.getinfo(2, \"n\").name",
" if name == \"fn\" then", " if name == \"fn\" then",
" name = \"Thread\"", " name = \"Thread\"",
" end", " end",
" local value = \"{\"..CLASS..\".\"..name..\"(\"..line..\")} \"..message", " local value = \"{\"..CLASS..\".\"..name..\"(\"..line..\")} \"..message",
" if tonumber(LOG_LEVEL) >= logLevel then", " if logLevel then",
" exports.SLF:LogToServer(RESOURCE_CODE, logLevel, value)", " if tonumber(LOG_LEVEL) >= logLevel then",
" exports.SLF:LogToServer(RESOURCE_CODE, logLevel, value)",
" end",
" else",
" exports.SLF:LogToServer(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",
"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" "end"
], ],
"description": "Server Side SLF Function" "description": "SLF Functions and Vars for SERVER."
}, },
"Client Side SLF Function": { "SLF Functions and Vars for CLIENT.": {
"prefix": "slfclient", "prefix": "SLFCLIENT",
"body": [ "body": [
"function Log(message, logLevel)", "--GLOBAL CONSTANTS",
"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 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",
"---@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 line = debug.getinfo(2, \"l\").currentline",
" local name = debug.getinfo(2, \"n\").name", " local name = debug.getinfo(2, \"n\").name",
" if name == \"fn\" then", " if name == \"fn\" then",
" name = \"Thread\"", " name = \"Thread\"",
" end", " end",
" local value = \"{\"..CLASS..\".\"..name..\"(\"..line..\")} \"..message", " local value = \"{\"..CLASS..\".\"..name..\"(\"..line..\")} \"..message",
" if tonumber(LOG_LEVEL) >= logLevel then", " if logLevel then",
" exports.SLF:LogToClient(RESOURCE_CODE, logLevel, value)", " 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",
"end" "end"
], ],
"description": "Client Side SLF Function" "description": "SLF Functions and Vars for client."
}, },
"Sets up TriggerClientEvent": { "Sets up TriggerClientEvent": {
"prefix": "tce", "prefix": "tce",

View File

@ -2,29 +2,12 @@
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)
--LOCAL VARIABLES
--END CONFIG
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
-------------------
--YOUR CODE HERE---
--HAPPY CODING!----
-------------------
------------------------------------------------------------------------------------------------
--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing --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
function Log(message, logLevel) local function Log(message, logLevel)
local line = debug.getinfo(2, "l").currentline local line = debug.getinfo(2, "l").currentline
local name = debug.getinfo(2, "n").name local name = debug.getinfo(2, "n").name
if name == "fn" then if name == "fn" then
@ -41,9 +24,20 @@ function Log(message, logLevel)
end end
end end
function GetSID(UUID) --LOCAL VARIABLES
Log("Requesting SID for UUID: "..UUID, 4)
local SID = exports.SPH:GetSID(UUID) --END CONFIG
Log("Retreived SID: "..SID.." for UUID: "..UUID, 4) -----------------------------------------------------------------------------------------------
return SID
end
-------------------
--YOUR CODE HERE---
--HAPPY CODING!----
-------------------

View File

@ -2,29 +2,13 @@
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)
--Global Variables
--LOCAL VARIABLES
--END CONFIG
-----------------------------------------------------------------------------------------------
-------------------
--YOUR CODE HERE---
--HAPPY CODING!----
-------------------
------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------
--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing. --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
function Log(message, logLevel) local function Log(message, logLevel)
local line = debug.getinfo(2, "l").currentline local line = debug.getinfo(2, "l").currentline
local name = debug.getinfo(2, "n").name local name = debug.getinfo(2, "n").name
if name == "fn" then if name == "fn" then
@ -41,7 +25,7 @@ function Log(message, logLevel)
end end
end end
function DisLog(message) local function DisLog(message)
local line = debug.getinfo(2, "l").currentline local line = debug.getinfo(2, "l").currentline
local name = debug.getinfo(2, "n").name local name = debug.getinfo(2, "n").name
if name == "fn" then if name == "fn" then
@ -50,10 +34,20 @@ function DisLog(message)
local value = "{"..CLASS.."."..name.."("..line..")} "..message local value = "{"..CLASS.."."..name.."("..line..")} "..message
exports.SLF:LogServerToDiscord(RESOURCE_CODE, message) exports.SLF:LogServerToDiscord(RESOURCE_CODE, message)
end end
--Global Variables
--LOCAL VARIABLES
--END CONFIG
-----------------------------------------------------------------------------------------------
-------------------
--YOUR CODE HERE---
--HAPPY CODING!----
-------------------
function GetSID(UUID)
Log("Requesting SID for UUID: "..UUID, 4)
local SID = exports.SPH:GetSID(UUID)
Log("Retreived SID: "..SID.." for UUID: "..UUID, 4)
return SID
end

View File

@ -2,29 +2,12 @@
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)
--LOCAL VARIABLES
--END CONFIG
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
-------------------
--YOUR CODE HERE---
--HAPPY CODING!----
-------------------
------------------------------------------------------------------------------------------------
--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing --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
function Log(message, logLevel) local function Log(message, logLevel)
local line = debug.getinfo(2, "l").currentline local line = debug.getinfo(2, "l").currentline
local name = debug.getinfo(2, "n").name local name = debug.getinfo(2, "n").name
if name == "fn" then if name == "fn" then
@ -41,9 +24,20 @@ function Log(message, logLevel)
end end
end end
function GetSID(UUID) --LOCAL VARIABLES
Log("Requesting SID for UUID: "..UUID, 4)
local SID = exports.SPH:GetSID(UUID) --END CONFIG
Log("Retreived SID: "..SID.." for UUID: "..UUID, 4) -----------------------------------------------------------------------------------------------
return SID
end
-------------------
--YOUR CODE HERE---
--HAPPY CODING!----
-------------------

View File

@ -2,29 +2,13 @@
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)
--Global Variables
--LOCAL VARIABLES
--END CONFIG
-----------------------------------------------------------------------------------------------
-------------------
--YOUR CODE HERE---
--HAPPY CODING!----
-------------------
------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------
--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing. --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
function Log(message, logLevel) local function Log(message, logLevel)
local line = debug.getinfo(2, "l").currentline local line = debug.getinfo(2, "l").currentline
local name = debug.getinfo(2, "n").name local name = debug.getinfo(2, "n").name
if name == "fn" then if name == "fn" then
@ -41,7 +25,7 @@ function Log(message, logLevel)
end end
end end
function DisLog(message) local function DisLog(message)
local line = debug.getinfo(2, "l").currentline local line = debug.getinfo(2, "l").currentline
local name = debug.getinfo(2, "n").name local name = debug.getinfo(2, "n").name
if name == "fn" then if name == "fn" then
@ -50,10 +34,20 @@ function DisLog(message)
local value = "{"..CLASS.."."..name.."("..line..")} "..message local value = "{"..CLASS.."."..name.."("..line..")} "..message
exports.SLF:LogServerToDiscord(RESOURCE_CODE, message) exports.SLF:LogServerToDiscord(RESOURCE_CODE, message)
end end
--Global Variables
--LOCAL VARIABLES
--END CONFIG
-----------------------------------------------------------------------------------------------
-------------------
--YOUR CODE HERE---
--HAPPY CODING!----
-------------------
function GetSID(UUID)
Log("Requesting SID for UUID: "..UUID, 4)
local SID = exports.SPH:GetSID(UUID)
Log("Retreived SID: "..SID.." for UUID: "..UUID, 4)
return SID
end