version_check.lua
· 2.6 KiB · Lua
Исходник
if CONFIG.System.UpdateCheck then
CreateThread(function()
local version = GetResourceMetadata(GetCurrentResourceName(), 'version', 0)
PerformHttpRequest(CONFIG.GithubApiURL .. 'repos/toxic-development/FiveM2Discord/releases/latest', function(err, text, headers)
local data = json.decode(text)
local git = CONFIG.GithubBaseURL .. 'toxic-development/FiveM2Discord/releases/latest'
if data.tag_name < version then
print('| =================================== ')
print('| FiveM2Discord | Update Check ')
print('| =================================== ')
print('| Current Version: ' .. version )
print('| Latest Version: ' .. data.tag_name )
print('| =================================== ')
print('| you are using an outdated version! ')
print('| Please grab the latest version from ')
print('| here:' .. git )
print('| =================================== ')
elseif data.tag_name > verion then
print('| ====================================== ')
print('| FiveM2Discord | Update Check ')
print('| ====================================== ')
print('| Current Version: ' .. version )
print('| Latest Version: ' .. data.tag_name )
print('| ====================================== ')
print('| i don\'t know how you traveled in time!')
print('| but you are using a higher version than')
print('| our current latest version! ')
print('| ====================================== ')
print('| please re-download/install the script ')
print('| from here: ' .. git )
print('| ====================================== ')
elseif data.tag_name == version then
print('| ====================================== ')
print('| FiveM2Discord | Update Check ')
print('| ====================================== ')
print('| Current Version: ' .. version )
print('| Latest Version: ' .. data.tag_name )
print('| ====================================== ')
print('| you are using the latest version! ')
print('| ====================================== ')
end
end, 'GET', '', { ['Content-Type'] = 'application/json' })
end)
end
1 | if CONFIG.System.UpdateCheck then |
2 | |
3 | CreateThread(function() |
4 | |
5 | local version = GetResourceMetadata(GetCurrentResourceName(), 'version', 0) |
6 | |
7 | PerformHttpRequest(CONFIG.GithubApiURL .. 'repos/toxic-development/FiveM2Discord/releases/latest', function(err, text, headers) |
8 | local data = json.decode(text) |
9 | local git = CONFIG.GithubBaseURL .. 'toxic-development/FiveM2Discord/releases/latest' |
10 | |
11 | if data.tag_name < version then |
12 | print('| =================================== ') |
13 | print('| FiveM2Discord | Update Check ') |
14 | print('| =================================== ') |
15 | print('| Current Version: ' .. version ) |
16 | print('| Latest Version: ' .. data.tag_name ) |
17 | print('| =================================== ') |
18 | print('| you are using an outdated version! ') |
19 | print('| Please grab the latest version from ') |
20 | print('| here:' .. git ) |
21 | print('| =================================== ') |
22 | elseif data.tag_name > verion then |
23 | print('| ====================================== ') |
24 | print('| FiveM2Discord | Update Check ') |
25 | print('| ====================================== ') |
26 | print('| Current Version: ' .. version ) |
27 | print('| Latest Version: ' .. data.tag_name ) |
28 | print('| ====================================== ') |
29 | print('| i don\'t know how you traveled in time!') |
30 | print('| but you are using a higher version than') |
31 | print('| our current latest version! ') |
32 | print('| ====================================== ') |
33 | print('| please re-download/install the script ') |
34 | print('| from here: ' .. git ) |
35 | print('| ====================================== ') |
36 | elseif data.tag_name == version then |
37 | print('| ====================================== ') |
38 | print('| FiveM2Discord | Update Check ') |
39 | print('| ====================================== ') |
40 | print('| Current Version: ' .. version ) |
41 | print('| Latest Version: ' .. data.tag_name ) |
42 | print('| ====================================== ') |
43 | print('| you are using the latest version! ') |
44 | print('| ====================================== ') |
45 | end |
46 | end, 'GET', '', { ['Content-Type'] = 'application/json' }) |
47 | end) |
48 | end |