最后活跃于 1703022368

Kinda self explanatory

TheRealToxicDev's Avatar TheRealToxicDev 修订了这个 Gist 1703022368. 跳至此修订

1 file changed, 48 insertions

version_check.lua(file created)

@@ -0,0 +1,48 @@
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
更新 更早