1.0 release
This commit is contained in:
parent
29c2c4a9d9
commit
f0fd9cd282
|
|
@ -0,0 +1,5 @@
|
|||
import { defineConfig } from '@vscode/test-cli';
|
||||
|
||||
export default defineConfig({
|
||||
files: 'out/test/**/*.test.js',
|
||||
});
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
.vscode/**
|
||||
.vscode-test/**
|
||||
src/**
|
||||
.gitignore
|
||||
.yarnrc
|
||||
vsc-extension-quickstart.md
|
||||
**/tsconfig.json
|
||||
**/eslint.config.mjs
|
||||
**/*.map
|
||||
**/*.ts
|
||||
**/.vscode-test.*
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# Change Log
|
||||
I will use this area to keep up with what i did last.
|
||||
|
||||
## [Release 1.0.0]
|
||||
|
||||
- Initial release
|
||||
- Updating SLFVARS to make the correct checks in fxmanifest instead of assuming 4
|
||||
|
|
@ -0,0 +1 @@
|
|||
All rights reserved © CSTMGames 2026
|
||||
13
README.md
13
README.md
|
|
@ -1,3 +1,12 @@
|
|||
# FiveM_Snippets
|
||||
# CSTMGames FiveM Snippets
|
||||
|
||||
This will house the snippet extension to make managing the snippets way easier
|
||||
A collection of custom Lua snippets for FiveM development.
|
||||
|
||||
## Features
|
||||
- SLF logging snippets
|
||||
- Event helpers
|
||||
- Thread templates
|
||||
- Common FiveM utilities
|
||||
|
||||
## Usage
|
||||
Type a snippet prefix and press Ctrl+Space.
|
||||
Binary file not shown.
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"name": "cstmgames-fivem-snippets",
|
||||
"displayName": "CSTMGames FiveM Snippets",
|
||||
"description": "Snippets for FiveM",
|
||||
"version": "1.0.0",
|
||||
"engines": {
|
||||
"vscode": "^1.110.0"
|
||||
},
|
||||
"icon": "pridelogo.png",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git.cstmgames.dev/CSTMGames/FiveM_Snippets.git"
|
||||
},
|
||||
"publisher": "CSTMGames - KJ4LXC",
|
||||
"categories": ["Snippets"],
|
||||
"contributes": {
|
||||
"snippets": [
|
||||
{
|
||||
"language": "lua",
|
||||
"path": "./snippets/cstmcommonfunctions.code-snippets"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 612 KiB |
|
|
@ -0,0 +1,178 @@
|
|||
{
|
||||
"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": {
|
||||
"prefix": "Log",
|
||||
"body": "Log(\"${1:Your Log Message Here}\", ${2|4,3,2,1|})$0",
|
||||
"description": "Sets up basic Log function for use with SLF"
|
||||
},
|
||||
"Log to Discord": {
|
||||
"prefix": "DisLog",
|
||||
"body": "DisLog(\"${1:Your Error Text Here}\")$0",
|
||||
"description": "SLF Function to log error to Discord."
|
||||
},
|
||||
"Sets up a basic Citizen Thread for CFX": {
|
||||
"prefix": "thread",
|
||||
"body": [
|
||||
"Citizen.CreateThread(function()",
|
||||
"$0",
|
||||
"",
|
||||
"",
|
||||
"end)"
|
||||
],
|
||||
"description": "Sets up a basic Citizen Thread for CFX"
|
||||
},
|
||||
"Sets up Net Event and its corresponding header": {
|
||||
"prefix": "netevent",
|
||||
"body": [
|
||||
"RegisterNetEvent(RESOURCE_CODE..\":${1:EventNameHere}\")",
|
||||
"AddEventHandler(RESOURCE_CODE..\":${2:EventNameHere}\", function(${3:args})",
|
||||
" $0",
|
||||
"end)"
|
||||
],
|
||||
"description": "Sets up Net Event and its corresponding header"
|
||||
},
|
||||
"Sets up command to be registered": {
|
||||
"prefix": "registercmd",
|
||||
"body": [
|
||||
"RegisterCommand(string.lower(RESOURCE_CODE)..\"${1:COMMANDNAMEHERE}\", function(source, args) ",
|
||||
" $0",
|
||||
"end, false)"
|
||||
],
|
||||
"description": "Sets up command to be registered"
|
||||
},
|
||||
"Server Side SLF Function": {
|
||||
"prefix": "slfserver",
|
||||
"body": [
|
||||
"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 tonumber(LOG_LEVEL) >= logLevel then",
|
||||
" exports.SLF:LogToServer(RESOURCE_CODE, logLevel, value)",
|
||||
" end",
|
||||
"end"
|
||||
],
|
||||
"description": "Server Side SLF Function"
|
||||
},
|
||||
"Client Side SLF Function": {
|
||||
"prefix": "slfclient",
|
||||
"body": [
|
||||
"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 tonumber(LOG_LEVEL) >= logLevel then",
|
||||
" exports.SLF:LogToClient(RESOURCE_CODE, logLevel, value)",
|
||||
" end",
|
||||
"end"
|
||||
],
|
||||
"description": "Client Side SLF Function"
|
||||
},
|
||||
"Sets up TriggerClientEvent": {
|
||||
"prefix": "tce",
|
||||
"body": [
|
||||
"TriggerClientEvent(RESOURCE_CODE..\":${1:EventNameHere}\", ${2:targetId}, ${3:args})$0"
|
||||
],
|
||||
"description": "Sets up TriggerClientEvent"
|
||||
},
|
||||
"Sets up TriggerEvent": {
|
||||
"prefix": "te",
|
||||
"body": [
|
||||
"TriggerEvent(RESOURCE_CODE..\":${1:EventNameHere}\", ${2:args})$0"
|
||||
],
|
||||
"description": "Sets up TriggerEvent"
|
||||
},
|
||||
"Sets up TriggerServerEvent": {
|
||||
"prefix": "tse",
|
||||
"body": [
|
||||
"TriggerServerEvent(RESOURCE_CODE..\":${1:EventNameHere}\", ${2:args})$0"
|
||||
],
|
||||
"description": "Sets up TriggerServerEvent"
|
||||
},
|
||||
"Sets up trigger for CSTMI invite": {
|
||||
"prefix": "cstmi",
|
||||
"body": [
|
||||
"TriggerClientEvent(\"CSTMI:StartInvite_cl\", ${1:targetId}, ${2:(Invite code... MUST HAVE RESOURCE IDENTIFIER)})$0"
|
||||
],
|
||||
"description": "Sets up trigger for CSTMI invite"
|
||||
},
|
||||
"While True Do": {
|
||||
"prefix": "wtd",
|
||||
"body": [
|
||||
"while true do",
|
||||
" $0",
|
||||
" Wait(${1:1})",
|
||||
"end"
|
||||
],
|
||||
"description": "While True Do"
|
||||
},
|
||||
"Look up SID by UUID": {
|
||||
"prefix": "sidconvert",
|
||||
"body": [
|
||||
"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"
|
||||
],
|
||||
"description": "Look up SID by UUID"
|
||||
},
|
||||
"Discord Rich Presence Call": {
|
||||
"prefix": "drpset",
|
||||
"body": [
|
||||
"local drp = {",
|
||||
" logo = '$1'",
|
||||
" hovText = \"$2\"",
|
||||
" description = \"$3\"",
|
||||
"}",
|
||||
"TriggerEvent(\"DRP:UpdateDRP\", drp)$0"
|
||||
],
|
||||
"description": "Discord Rich Presence Call"
|
||||
},
|
||||
"Discord Rich Presence Reset": {
|
||||
"prefix": "drpclear",
|
||||
"body": [
|
||||
"TriggerEvent(\"DRP:ClearDRP\", drp)$0"
|
||||
],
|
||||
"description": "Discord Rich Presence Reset"
|
||||
},
|
||||
"Thread Client Event Call": {
|
||||
"prefix": "tct",
|
||||
"body": [
|
||||
"TriggerClientEvent(threadID..\":${1:EventNameHere}\", ${2:targetId}, ${3:args})$0"
|
||||
],
|
||||
"description": "Thread Client Event Call"
|
||||
},
|
||||
"Thread Server Event Call": {
|
||||
"prefix": "tst",
|
||||
"body": [
|
||||
"TriggerServerEvent(threadID..\":${1:EventNameHere}\", ${2:args})$0"
|
||||
],
|
||||
"description": "Thread Server Event Call"
|
||||
},
|
||||
"Thread Net Register": {
|
||||
"prefix": "tnet",
|
||||
"body": [
|
||||
"RegisterNetEvent(threadID..\":${1:EventNameHere}\")",
|
||||
"AddEventHandler(threadID..\":${2:EventNameHere}\", function(${3:args})",
|
||||
" $0",
|
||||
"end)"
|
||||
],
|
||||
"description": "Thread Net Register"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "Node16",
|
||||
"target": "ES2022",
|
||||
"outDir": "out",
|
||||
"lib": [
|
||||
"ES2022"
|
||||
],
|
||||
"sourceMap": true,
|
||||
"rootDir": "src",
|
||||
"strict": true, /* enable all strict type-checking options */
|
||||
/* Additional Checks */
|
||||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue