mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-19 06:46:04 +01:00
add supress_updates variable to config
This new `fxmanifest.lua` variable (when true) will stop checking for script updates People REALLY dont like being told when somethings fixed. This will stop the update notifications for both `jim_bridge` and the script that loads it.
This commit is contained in:
@@ -1,12 +1,22 @@
|
|||||||
local function parseVersion(version)
|
local function readBoolMeta(key, default)
|
||||||
|
local val = GetResourceMetadata(GetCurrentResourceName(), key, 0)
|
||||||
|
if not val then return default end
|
||||||
|
val = tostring(val):lower()
|
||||||
|
return (val == 'true' or val == '1' or val == 'yes' or val == 'on')
|
||||||
|
end
|
||||||
|
|
||||||
|
local SUPPRESS_UPDATES = readBoolMeta('suppress_updates', false)
|
||||||
|
|
||||||
|
if not SUPPRESS_UPDATES then
|
||||||
|
local function parseVersion(version)
|
||||||
local parts = {}
|
local parts = {}
|
||||||
for num in version:gmatch("%d+") do
|
for num in version:gmatch("%d+") do
|
||||||
table.insert(parts, tonumber(num))
|
table.insert(parts, tonumber(num))
|
||||||
end
|
end
|
||||||
return parts
|
return parts
|
||||||
end
|
end
|
||||||
|
|
||||||
local function compareVersions(current, newest)
|
local function compareVersions(current, newest)
|
||||||
local currentParts = parseVersion(current)
|
local currentParts = parseVersion(current)
|
||||||
local newestParts = parseVersion(newest)
|
local newestParts = parseVersion(newest)
|
||||||
for i = 1, math.max(#currentParts, #newestParts) do
|
for i = 1, math.max(#currentParts, #newestParts) do
|
||||||
@@ -16,9 +26,9 @@ local function compareVersions(current, newest)
|
|||||||
elseif c > n then return 1 end
|
elseif c > n then return 1 end
|
||||||
end
|
end
|
||||||
return 0 -- equal
|
return 0 -- equal
|
||||||
end
|
end
|
||||||
|
|
||||||
function CheckBridgeVersion()
|
function CheckBridgeVersion()
|
||||||
if IsDuplicityVersion() then
|
if IsDuplicityVersion() then
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
Wait(4000)
|
Wait(4000)
|
||||||
@@ -61,7 +71,8 @@ function CheckBridgeVersion()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
CheckBridgeVersion()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
CheckBridgeVersion()
|
|
||||||
@@ -7,7 +7,6 @@ rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aw
|
|||||||
games { 'gta5', 'rdr3' }
|
games { 'gta5', 'rdr3' }
|
||||||
lua54 'yes'
|
lua54 'yes'
|
||||||
|
|
||||||
|
|
||||||
files {
|
files {
|
||||||
'starter.lua',
|
'starter.lua',
|
||||||
'shared/*.lua',
|
'shared/*.lua',
|
||||||
@@ -25,3 +24,5 @@ client_scripts {
|
|||||||
'clientFrameworkCache.lua',
|
'clientFrameworkCache.lua',
|
||||||
'ui_modules/*.lua',
|
'ui_modules/*.lua',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suppress_updates 'true' -- set to 'true' to disable update pings
|
||||||
@@ -1,12 +1,22 @@
|
|||||||
function parseVersion(version)
|
local function readBoolMeta(key, default)
|
||||||
|
local val = GetResourceMetadata("jim_bridge", key, 0)
|
||||||
|
if not val then return default end
|
||||||
|
val = tostring(val):lower()
|
||||||
|
return (val == 'true' or val == '1' or val == 'yes' or val == 'on')
|
||||||
|
end
|
||||||
|
|
||||||
|
local SUPPRESS_UPDATES = readBoolMeta('suppress_updates', false)
|
||||||
|
|
||||||
|
if not SUPPRESS_UPDATES then
|
||||||
|
function parseVersion(version)
|
||||||
local parts = {}
|
local parts = {}
|
||||||
for num in version:gmatch("%d+") do
|
for num in version:gmatch("%d+") do
|
||||||
table.insert(parts, tonumber(num))
|
table.insert(parts, tonumber(num))
|
||||||
end
|
end
|
||||||
return parts
|
return parts
|
||||||
end
|
end
|
||||||
|
|
||||||
function compareVersions(current, newest)
|
function compareVersions(current, newest)
|
||||||
local currentParts = parseVersion(current)
|
local currentParts = parseVersion(current)
|
||||||
local newestParts = parseVersion(newest)
|
local newestParts = parseVersion(newest)
|
||||||
for i = 1, math.max(#currentParts, #newestParts) do
|
for i = 1, math.max(#currentParts, #newestParts) do
|
||||||
@@ -16,20 +26,20 @@ function compareVersions(current, newest)
|
|||||||
elseif c > n then return 1 end
|
elseif c > n then return 1 end
|
||||||
end
|
end
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function capitalize(str)
|
function capitalize(str)
|
||||||
return (str:gsub("^%l", string.upper):gsub("%-%l", function(letter) return "-" .. string.upper(letter:sub(2)) end))
|
return (str:gsub("^%l", string.upper):gsub("%-%l", function(letter) return "-" .. string.upper(letter:sub(2)) end))
|
||||||
end
|
end
|
||||||
|
|
||||||
local scriptName = ("^2"..capitalize(getScript()):gsub("%-", "^7-^2"):gsub("%_", "^7_^2")) or ""
|
local scriptName = ("^2"..capitalize(getScript()):gsub("%-", "^7-^2"):gsub("%_", "^7_^2")) or ""
|
||||||
local scriptVersion = ("^5"..GetResourceMetadata(getScript(), 'version', nil):gsub("%.", "^7.^5")) or ""
|
local scriptVersion = ("^5"..GetResourceMetadata(getScript(), 'version', nil):gsub("%.", "^7.^5")) or ""
|
||||||
local scriptDescription = ("^2"..GetResourceMetadata(getScript(), 'description', nil)) or ""
|
local scriptDescription = ("^2"..GetResourceMetadata(getScript(), 'description', nil)) or ""
|
||||||
local scriptAuthor = ("^2by ^4"..GetResourceMetadata(getScript(), 'author', nil):gsub("%and", "^7and^4")) or ""
|
local scriptAuthor = ("^2by ^4"..GetResourceMetadata(getScript(), 'author', nil):gsub("%and", "^7and^4")) or ""
|
||||||
|
|
||||||
print(scriptName.." ^7v"..scriptVersion.."^7 - "..scriptDescription.." "..scriptAuthor.."^7")
|
print(scriptName.." ^7v"..scriptVersion.."^7 - "..scriptDescription.." "..scriptAuthor.."^7")
|
||||||
|
|
||||||
function CheckVersion()
|
function CheckVersion()
|
||||||
if isServer() and GetResourceMetadata(getScript(), 'author', nil) == "Jimathy" then
|
if isServer() and GetResourceMetadata(getScript(), 'author', nil) == "Jimathy" then
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
Wait(4000)
|
Wait(4000)
|
||||||
@@ -95,6 +105,7 @@ function CheckVersion()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
CheckVersion()
|
CheckVersion()
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user