-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathversionchecker.lua
More file actions
34 lines (31 loc) · 1.14 KB
/
versionchecker.lua
File metadata and controls
34 lines (31 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
-- Version checker
Citizen.CreateThread(function()
Citizen.Wait(2000)
local resourceName = GetCurrentResourceName()
local currentVersion = GetResourceMetadata(resourceName, "version", 0)
PerformHttpRequest("https://api.github.com/repos/chaixshot/critScaleforms/releases/latest", function(errorCode, resultData, resultHeaders)
if errorCode == 200 then
local data = json.decode(resultData)
local updateVersion = currentVersion
if currentVersion ~= data.tag_name then
updateVersion = data.tag_name
end
if updateVersion ~= currentVersion then
local function Do()
print("\n^0--------------- "..resourceName.." ---------------")
print("^3"..resourceName.."^7 update available")
print("^1✗ Current version: "..currentVersion)
print("^2✓ Latest version: "..updateVersion)
print("^5https://github.com/chaixshot/critScaleforms/releases/latest")
if data.body then
print("^3Changelog:")
print("^7"..data.body)
end
print("^0--------------- "..resourceName.." ---------------\n")
Citizen.SetTimeout(10 * 60 * 1000, Do)
end
Do()
end
end
end)
end)