forked from Rexshack-RedM/rsg-spawn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.lua
40 lines (30 loc) · 1.59 KB
/
server.lua
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
local RSGCore = exports['rsg-core']:GetCoreObject()
-----------------------------------------------------------------------
-- version checker
-----------------------------------------------------------------------
local function versionCheckPrint(_type, log)
local color = _type == 'success' and '^2' or '^1'
print(('^5['..GetCurrentResourceName()..']%s %s^7'):format(color, log))
end
local function CheckVersion()
PerformHttpRequest('https://raw.githubusercontent.com/Rexshack-RedM/rsg-spawn/main/version.txt', function(err, text, headers)
local currentVersion = GetResourceMetadata(GetCurrentResourceName(), 'version')
if not text then
versionCheckPrint('error', 'Currently unable to run a version check.')
return
end
--versionCheckPrint('success', ('Current Version: %s'):format(currentVersion))
--versionCheckPrint('success', ('Latest Version: %s'):format(text))
if text == currentVersion then
versionCheckPrint('success', 'You are running the latest version.')
else
versionCheckPrint('error', ('You are currently running an outdated version, please update to version %s'):format(text))
end
end)
end
-----------------------------------------------------------------------
-----------------------------------------------------------------------
--------------------------------------------------------------------------------------------------
-- start version check
--------------------------------------------------------------------------------------------------
CheckVersion()