0.3.0 Update Features and Bugfix update
Fixed all the things.
This commit is contained in:
parent
d05b674efa
commit
b384da9837
Binary file not shown.
|
|
@ -3,7 +3,7 @@
|
||||||
"name": "CSTM-RESOURCE-GENERATOR",
|
"name": "CSTM-RESOURCE-GENERATOR",
|
||||||
"displayName": "CSTM Five Alive 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",
|
"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": {
|
"engines": {
|
||||||
"vscode": "^1.59.0"
|
"vscode": "^1.59.0"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -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
|
local CLASS = "CHANGEME"--This is the name that the logging framework will use to display your logs in the correct manner
|
||||||
--BEGIN CONFIG
|
local LOG_LEVEL = GetResourceMetadata(GetCurrentResourceName(), "log_level", 0)
|
||||||
--Global Constants
|
|
||||||
local LOG_LEVEL = 4
|
|
||||||
local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_code", 0)
|
local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_code", 0)
|
||||||
--Global Constants
|
|
||||||
--LOCAL VARIABLES
|
--LOCAL VARIABLES
|
||||||
local config = {}
|
|
||||||
|
|
||||||
|
|
||||||
--END 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.
|
--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing.
|
||||||
function Log(message, logLevel)
|
function Log(message, logLevel)
|
||||||
local line = debug.getinfo(2, "l").currentline
|
local line = debug.getinfo(2, "l").currentline
|
||||||
|
|
|
||||||
|
|
@ -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; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" href="reset.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="loadsplash.css" type="text/css">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Fjalla+One&family=Inconsolata:wght@300&display=swap" rel="stylesheet">
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Fjalla+One&family=Inconsolata:wght@300&family=Roboto+Condensed&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
|
||||||
|
<script src="nui://game/ui/jquery.js" type="text/javascript"></script>
|
||||||
|
<script src="nui://game/ui/jquery.js" type="text/javascript"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/howler/2.1.1/howler.min.js" type="text/javascript"></script>
|
||||||
|
<script>
|
||||||
|
var audioPlayer = null;
|
||||||
|
// Listen for NUI Messages.
|
||||||
|
window.addEventListener('message', function(event) {
|
||||||
|
// Check for playSound transaction
|
||||||
|
if (event.data.transactionType == "playSound") {
|
||||||
|
|
||||||
|
if (audioPlayer != null) {
|
||||||
|
audioPlayer.pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
audioPlayer = new Howl({src: ["./sounds/" + event.data.transactionFile + ".ogg"]});
|
||||||
|
audioPlayer.volume(event.data.transactionVolume);
|
||||||
|
audioPlayer.play();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body id="splashScreen" class="unselectable w3-display-container">
|
||||||
|
<div class="w3-animate-opacity">
|
||||||
|
<script src="./loadsplash.js" type="text/javascript"></script>
|
||||||
|
<div id="loader" class="loader"></div>
|
||||||
|
<div class="fade-in-image">
|
||||||
|
<img id="bgIMG" src="https://images.cstm.games/imgstor/splashscreens/defaultsplash.png" alt="" style="width:100%;height:100%;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -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)
|
||||||
|
})
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
Binary file not shown.
|
|
@ -1,41 +1,44 @@
|
||||||
fx_version 'adamant'
|
fx_version 'adamant'
|
||||||
game 'gta5'
|
game 'gta5'
|
||||||
|
name "${resourceName}"
|
||||||
resource_code "${resourceCode}"--The Resource Code is used everywhere in our
|
description "${description}"
|
||||||
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
|
author "CSTMChristina & KJ4LXC"
|
||||||
description "${description}" --Explains itself.
|
|
||||||
author "CSTMChristina & KJ4LXC"--Who are you again?
|
|
||||||
version "0.0.1"
|
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 {
|
dependencies {
|
||||||
"GCONFIG",
|
|
||||||
"SLF",
|
"SLF",
|
||||||
"SCF"
|
"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_scripts {
|
||||||
-- 'shared/*.lua'
|
-- 'shared/*.lua'
|
||||||
-- }
|
-- }
|
||||||
|
|
||||||
|
|
||||||
--Client Scripts run on the client only.
|
|
||||||
client_scripts {
|
client_scripts {
|
||||||
|
'@MODELS/*.lua',
|
||||||
'client/*.lua',
|
'client/*.lua',
|
||||||
'menus/*.lua'
|
'menus/*.lua'
|
||||||
}
|
}
|
||||||
|
|
||||||
--Server Scripts run on the server only.
|
|
||||||
server_scripts {
|
server_scripts {
|
||||||
|
'@MODELS/*.lua',
|
||||||
'server/*.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.
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
{
|
|
||||||
"configs": [
|
|
||||||
{
|
|
||||||
"name": "LOG_LEVEL",
|
|
||||||
"value": 4
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Test1",
|
|
||||||
"value": "Success"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Test2",
|
|
||||||
"value": 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
--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 RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_code", 0)
|
||||||
local USE_MYSQL = tonumber(GetResourceMetadata(GetCurrentResourceName(), "USE_MYSQL", 0))
|
|
||||||
|
|
||||||
--Global Constants
|
|
||||||
--Global Variables
|
--Global Variables
|
||||||
--LOCAL VARIABLES
|
--LOCAL VARIABLES
|
||||||
local config = {}
|
|
||||||
|
|
||||||
--END 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.
|
--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing.
|
||||||
function Log(message, logLevel)
|
function Log(message, logLevel)
|
||||||
local line = debug.getinfo(2, "l").currentline
|
local line = debug.getinfo(2, "l").currentline
|
||||||
|
|
|
||||||
Reference in New Issue