mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-16 21:46:03 +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 = {}
|
||||
for num in version:gmatch("%d+") do
|
||||
table.insert(parts, tonumber(num))
|
||||
end
|
||||
return parts
|
||||
end
|
||||
end
|
||||
|
||||
local function compareVersions(current, newest)
|
||||
local function compareVersions(current, newest)
|
||||
local currentParts = parseVersion(current)
|
||||
local newestParts = parseVersion(newest)
|
||||
for i = 1, math.max(#currentParts, #newestParts) do
|
||||
@@ -16,9 +26,9 @@ local function compareVersions(current, newest)
|
||||
elseif c > n then return 1 end
|
||||
end
|
||||
return 0 -- equal
|
||||
end
|
||||
end
|
||||
|
||||
function CheckBridgeVersion()
|
||||
function CheckBridgeVersion()
|
||||
if IsDuplicityVersion() then
|
||||
CreateThread(function()
|
||||
Wait(4000)
|
||||
@@ -61,7 +71,8 @@ function CheckBridgeVersion()
|
||||
end)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
CheckBridgeVersion()
|
||||
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' }
|
||||
lua54 'yes'
|
||||
|
||||
|
||||
files {
|
||||
'starter.lua',
|
||||
'shared/*.lua',
|
||||
@@ -25,3 +24,5 @@ client_scripts {
|
||||
'clientFrameworkCache.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 = {}
|
||||
for num in version:gmatch("%d+") do
|
||||
table.insert(parts, tonumber(num))
|
||||
end
|
||||
return parts
|
||||
end
|
||||
end
|
||||
|
||||
function compareVersions(current, newest)
|
||||
function compareVersions(current, newest)
|
||||
local currentParts = parseVersion(current)
|
||||
local newestParts = parseVersion(newest)
|
||||
for i = 1, math.max(#currentParts, #newestParts) do
|
||||
@@ -16,20 +26,20 @@ function compareVersions(current, newest)
|
||||
elseif c > n then return 1 end
|
||||
end
|
||||
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))
|
||||
end
|
||||
end
|
||||
|
||||
local scriptName = ("^2"..capitalize(getScript()):gsub("%-", "^7-^2"):gsub("%_", "^7_^2")) or ""
|
||||
local scriptVersion = ("^5"..GetResourceMetadata(getScript(), 'version', nil):gsub("%.", "^7.^5")) or ""
|
||||
local scriptDescription = ("^2"..GetResourceMetadata(getScript(), 'description', nil)) or ""
|
||||
local scriptAuthor = ("^2by ^4"..GetResourceMetadata(getScript(), 'author', nil):gsub("%and", "^7and^4")) 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 scriptDescription = ("^2"..GetResourceMetadata(getScript(), 'description', nil)) 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
|
||||
CreateThread(function()
|
||||
Wait(4000)
|
||||
@@ -95,6 +105,7 @@ function CheckVersion()
|
||||
end)
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
CheckVersion()
|
||||
CheckVersion()
|
||||
end
|
||||
Reference in New Issue
Block a user