-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathversion_check.lua
More file actions
60 lines (54 loc) · 2.4 KB
/
version_check.lua
File metadata and controls
60 lines (54 loc) · 2.4 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
--------------------------------------------------------------------------------------------
-- Guardian- A Far More Advanced FiveM Script Than DiscordWhitelist, Made By Jordan.#2139 --
--------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------
-- !WARNING! !WARNING! !WARNING! !WARNING! !WARNING! --
-- DO NOT TOUCH THIS FILE OR YOU /WILL/ FUCK SHIT UP! EDIT THE CONFIG.LUA --
-- DO NOT BE STUPID AND WHINE TO ME ABOUT THIS BEING BROKEN IF YOU TOUCHED THE LINES BELOW. --
----------------------------------------------------------------------------------------------
local label =
[[
//
||
||
|| ______ ___
|| / ____/_ ______ __________/ (_)___ _____
|| / / __/ / / / __ `/ ___/ __ / / __ `/ __ \
|| / /_/ / /_/ / /_/ / / / /_/ / / /_/ / / / /
|| \____/\__,_/\__,_/_/ \__,_/_/\__,_/_/ /_/
||
|| Created by Jordan.#2139
||]]
Citizen.CreateThread(function()
local CurrentVersion = GetResourceMetadata(GetCurrentResourceName(), 'version', 0)
if not CurrentVersion then
print('^1Guardian Version Check Failed!^7')
end
function VersionCheckHTTPRequest()
PerformHttpRequest('https://raw.githubusercontent.com/Jordan2139/versions/master/guardian.json', VersionCheck, 'GET')
end
function VersionCheck(err, response, headers)
Citizen.Wait(3000)
if err == 200 then
local Data = json.decode(response)
if CurrentVersion ~= Data.NewestVersion then
print( label )
print(' || \n || Guardian is outdated!')
print(' || Current version: ^2' .. Data.NewestVersion .. '^7')
print(' || Your version: ^1' .. CurrentVersion .. '^7')
print(' || Please download the lastest version from ^5' .. Data.DownloadLocation .. '^7')
if Data.Changes ~= '' then
print(' || \n || ^5Changes: ^7' .. Data.Changes .. "\n^0 \\\\\n")
end
else
print( label )
print(' || ^2Guardian is up to date!\n^0 ||\n \\\\\n')
end
else
print( label )
print(' || ^1There was an error getting the latest version information, if the issue persists contact Jordan.#2139 on Discord.\n^0 ||\n \\\\\n')
end
SetTimeout(60000000, VersionCheckHTTPRequest)
end
VersionCheckHTTPRequest()
end)