diff --git a/CSTM-RESOURCE-GENERATOR-0.2.2.vsix b/CSTM-RESOURCE-GENERATOR-0.3.0.vsix similarity index 99% rename from CSTM-RESOURCE-GENERATOR-0.2.2.vsix rename to CSTM-RESOURCE-GENERATOR-0.3.0.vsix index 005425e..7bbd526 100644 Binary files a/CSTM-RESOURCE-GENERATOR-0.2.2.vsix and b/CSTM-RESOURCE-GENERATOR-0.3.0.vsix differ diff --git a/package.json b/package.json index 2bca73a..5504313 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "name": "CSTM-RESOURCE-GENERATOR", "displayName": "CSTM Five Alive Resource Generator", "description": "This is an internal tool to help you in creating a new basic lua resource for FiveAlive", - "version": "0.2.2", + "version": "0.3.0", "engines": { "vscode": "^1.59.0" }, diff --git a/template/client/client.lua b/template/client/client.lua index a428170..5831c93 100644 --- a/template/client/client.lua +++ b/template/client/client.lua @@ -1,11 +1,9 @@ +--GLOBAL CONSTANTS local CLASS = "CHANGEME"--This is the name that the logging framework will use to display your logs in the correct manner ---BEGIN CONFIG ---Global Constants -local LOG_LEVEL = 4 +local LOG_LEVEL = GetResourceMetadata(GetCurrentResourceName(), "log_level", 0) local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_code", 0) ---Global Constants --LOCAL VARIABLES -local config = {} + --END CONFIG @@ -21,19 +19,6 @@ local config = {} ------------------------------------------------------------------------------------------------ ---Config Syncing Function DO NOT TOUCH unless you know what you are doing. -RegisterNetEvent(RESOURCE_CODE..":ConfigUpdate_cl") -AddEventHandler(RESOURCE_CODE..":ConfigUpdate_cl", function(cfg) - local config = cfg - for i, qResult in pairs(config) do - Log("QRESULT.CONFIGNAME "..qResult.ConfigName, 4) - if qResult.ConfigName == "LOG_LEVEL" then - LOG_LEVEL = qResult.ConfigValue - elseif qResult.ConfigName == "CHANGEME" then - CHANGE_ME = qResult.ConfigValue - end - end -end) --SLF Server Logging Function DO NOT TOUCH unless you know what you are doing. function Log(message, logLevel) local line = debug.getinfo(2, "l").currentline diff --git a/template/client/html/loadsplash.css b/template/client/html/loadsplash.css new file mode 100644 index 0000000..7fc54eb --- /dev/null +++ b/template/client/html/loadsplash.css @@ -0,0 +1,57 @@ +body { + font-size: 20px; + text-align: center; +} + +.unselectable { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; +} + +.loader { + border: 16px solid #6d6d6dc4; /* Light grey */ + border-top: 16px solid #4f2580; /* purple */ + border-radius: 50%; + width: 120px; + height: 120px; + animation: spin 2s linear infinite; + right: 1%; + bottom: 1%; + position: fixed; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} + +.fade-in-image { + animation: fadeIn 1.5S; + -webkit-animation: fadeIn 1.5S; + -moz-animation: fadeIn 1.5S; + -o-animation: fadeIn 1.5S; + -ms-animation: fadeIn 1.5S; +} + +@keyframes fadeIn { + 0% { opacity: 0; } + 100% { opacity: 1; } +} + +.fade-out-image { + animation: fadeOut 1.5S; + -webkit-animation: fadeOut 1.5S; + -moz-animation: fadeOut 1.5S; + -o-animation: fadeOut 1.5S; + -ms-animation: fadeOut 1.5S; +} + +@keyframes fadeOut { + 0% { opacity: 1; } + 100% { opacity: 0; } +} \ No newline at end of file diff --git a/template/client/html/loadsplash.html b/template/client/html/loadsplash.html new file mode 100644 index 0000000..354ad73 --- /dev/null +++ b/template/client/html/loadsplash.html @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + +
+ +
+
+ +
+
+ + \ No newline at end of file diff --git a/template/client/html/loadsplash.js b/template/client/html/loadsplash.js new file mode 100644 index 0000000..11d978c --- /dev/null +++ b/template/client/html/loadsplash.js @@ -0,0 +1,47 @@ +$(function () { + function showSplash(bool) { + if (bool) { + $("#splashScreen").show(); + } else { + $("#splashScreen").hide(); + } + } + + function showLoadingSplash(bool) { + if (bool) { + $("#splashScreen").show(); + $("#loader").show(); + } else { + $("#splashScreen").hide(); + $("#loader").hide(); + } + } + + window.addEventListener('message', function(event) { + var item = event.data; + + // Show or hide the splash screen without loading spinner + if (item.type === "showSplash") { + if (item.status == true) { + showSplash(true) + } else { + showSplash(false) + } + } + + // Show or hide the loading splash screen + if (item.type === "showLoadingSplash") { + if (item.status == true) { + showLoadingSplash(true) + } else { + showLoadingSplash(false) + } + } + + if (item.type === "setIMG") { + document.getElementById("bgIMG").src = item.value; + } + }) + + showLoadingSplash(false) +}) \ No newline at end of file diff --git a/template/client/html/reset.css b/template/client/html/reset.css new file mode 100644 index 0000000..af94440 --- /dev/null +++ b/template/client/html/reset.css @@ -0,0 +1,48 @@ +/* http://meyerweb.com/eric/tools/css/reset/ + v2.0 | 20110126 + License: none (public domain) +*/ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +} \ No newline at end of file diff --git a/template/client/html/sounds/warning.ogg b/template/client/html/sounds/warning.ogg new file mode 100644 index 0000000..555b207 Binary files /dev/null and b/template/client/html/sounds/warning.ogg differ diff --git a/template/fxmanifest.lua b/template/fxmanifest.lua index 0f390d9..1712ed5 100644 --- a/template/fxmanifest.lua +++ b/template/fxmanifest.lua @@ -1,41 +1,44 @@ fx_version 'adamant' game 'gta5' - -resource_code "${resourceCode}"--The Resource Code is used everywhere in our -name "${resourceName}"--This is the "pretty name" of your script. This will be used for any "name facing" code that is displayed to the user -description "${description}" --Explains itself. -author "CSTMChristina & KJ4LXC"--Who are you again? +name "${resourceName}" +description "${description}" +author "CSTMChristina & KJ4LXC" version "0.0.1" +resource_code "${resourceCode}" +log_level '4' +bucket_prefix '9' +SPLASH_IMG 'https://images.cstm.games/imgstor/splashscreens/defaultsplash.png' + ---Dependencies are the resources that your resource and just not do without. Add additional Resource Codes for any other resources that we have not included in the list already if you need to declare them as a dependency. dependencies { - "GCONFIG", "SLF", "SCF" } ---Shared Scripts are scripts shared between both the server and the client. These will run on both server and client, not run on server and allow the clients to use them. Be careful about using net events in these. Its best to use exports if you need to do something inside them. (SCF for instance.) +files { + 'client/html/index.html', + 'client/html/sounds/*.ogg', + 'client/config/*.json', + 'client/html/loadsplash.html', + 'client/html/loadsplash.js', + 'client/html/loadsplash.css', + 'client/html/reset.css' +} + +ui_page "client/html/loadsplash.html" + -- shared_scripts { -- 'shared/*.lua' -- } - ---Client Scripts run on the client only. client_scripts { + '@MODELS/*.lua', 'client/*.lua', 'menus/*.lua' } ---Server Scripts run on the server only. server_scripts { + '@MODELS/*.lua', 'server/*.lua' -} - ---Files that need to be provided directly to the client for use (sound files, html for visuals, etc) need to be declared in this section. Blobing is supported (folder/*.lua etc) --- files { - --- } - -log_level '4' -USE_MYSQL '1'--This tells the script to call GCONFIG for its updates and if it isn't in the database add them. \ No newline at end of file +} \ No newline at end of file diff --git a/template/initConfig.json b/template/initConfig.json deleted file mode 100644 index 5b4772d..0000000 --- a/template/initConfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "configs": [ - { - "name": "LOG_LEVEL", - "value": 4 - }, - { - "name": "Test1", - "value": "Success" - }, - { - "name": "Test2", - "value": 1 - } - ] -} \ No newline at end of file diff --git a/template/server/server.lua b/template/server/server.lua index 7de7d41..f5f65a6 100644 --- a/template/server/server.lua +++ b/template/server/server.lua @@ -1,14 +1,10 @@ -local CLASS = "CHANGEME"--This is the name that the logging framework will use to display your logs in the correct manner ---BEGIN CONFIG --GLOBAL CONSTANTS -local LOG_LEVEL = 4 +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) -local USE_MYSQL = tonumber(GetResourceMetadata(GetCurrentResourceName(), "USE_MYSQL", 0)) - ---Global Constants --Global Variables --LOCAL VARIABLES -local config = {} + --END CONFIG ----------------------------------------------------------------------------------------------- @@ -23,77 +19,6 @@ local config = {} ------------------------------------------------------------------------------------------------ ---Config Syncing Function DO NOT TOUCH unless you know what you are doing. -Citizen.CreateThread(function() - local cfgCounter = 0 - local RunOnce = true - local RunConfig = true - while RunConfig do - local cfgToLoad = {} - local initconfig = json.decode(LoadResourceFile(GetCurrentResourceName(), "initconfig.json")) - if USE_MYSQL == 1 and RunOnce then - local ready = exports.GCONFIG:IsReady() - if ready then - if cfgCounter <= 3 then - local qResults = exports.GCONFIG:GetConfig(RESOURCE_CODE) - if qResults ~= -1 then - cfgToLoad = exports.GCONFIG:GetConfigWithUNI(RESOURCE_CODE) - RunOnce = false - cfgCounter = 0 - else - local initconfig = json.decode(LoadResourceFile(GetCurrentResourceName(), "initConfig.json")) - TriggerEvent("GCONFIG:CreateInitialConfig", RESOURCE_CODE, initconfig) - --INCREMENT COUNTER - cfgCounter = cfgCounter + 1 - Log("Config re-running in 1sec to procure updated MySQL values...", 4) - end - elseif cfgCounter > 3 then - Log("Config retry reached max limit, loading config defaults. Check GCONFIG", 1) - RunOnce = false - cfgToLoad = initconfig - else - Log("I have no clue how you have arrived here, something is very wrong...", 1) - end - end - else - Log("RunOnce check aborted as UseMySQL is not TRUE.", 4) - RunOnce = false - cfgToLoad = initconfig - end - if not RunOnce and RunConfig then - UpdateConfigs(cfgToLoad) - RunConfig = false - end - Wait(1000) - end -end) - -function UpdateConfigs(cfgJson) --for loop that reads all variables from config file. - Log("Updating Config", 4) - config = cfgJson - for i, qResult in pairs(config) do - Log("QRESULT.CONFIGNAME "..qResult.ConfigName, 4) - if qResult.ConfigName == "LOG_LEVEL" then - LOG_LEVEL = qResult.ConfigValue - elseif qResult.ConfigName == "CHANGEME" then - CHANGE_ME = qResult.ConfigValue - end - end - Wait(1000) - TriggerClientEvent(RESOURCE_CODE..":ConfigUpdate_cl", -1, config) -end - -RegisterNetEvent(RESOURCE_CODE..":ConfigUpdate_sv") -AddEventHandler(RESOURCE_CODE..":ConfigUpdate_sv", function(cfgJson) - UpdateConfigs(cfgJson) - Wait(0) - TriggerClientEvent(RESOURCE_CODE..":ConfigUpdate_cl", -1, cfgJson) -end) - -RegisterCommand(string.lower(RESOURCE_CODE).."gconfig", function(source, args) - TriggerEvent("GCONFIG:UpdateMe", RESOURCE_CODE, true) -end) - --SLF Server Logging Function DO NOT TOUCH unless you know what you are doing. function Log(message, logLevel) local line = debug.getinfo(2, "l").currentline