-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.lua
More file actions
34 lines (29 loc) · 1.37 KB
/
Copy pathserver.lua
File metadata and controls
34 lines (29 loc) · 1.37 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
local githubRepo = "msaber07/nova-loadingscreen"
AddEventHandler('playerConnecting', function(name, setKickReason, deferrals)
local playerCount = #GetPlayers()
local maxClients = GetConvarInt('sv_maxclients', 48)
deferrals.handover({
playerCount = playerCount,
maxClients = maxClients
})
end)
Citizen.CreateThread(function()
-- Yerel version.json dosyasını oku
local localFile = LoadResourceFile(GetCurrentResourceName(), 'version.json')
if not localFile then return end
local localData = json.decode(localFile)
if not localData or not localData.version then return end
local currentVersion = localData.version
-- GitHub üzerindeki sürüm dosyasını sorgula
PerformHttpRequest("https://raw.githubusercontent.com/" .. githubRepo .. "/main/version.json", function(statusCode, responseText, headers)
if statusCode == 200 and responseText then
local data = json.decode(responseText)
if data and data.version then
if data.version ~= currentVersion then
print(("^3An update is available for %s (current version: %s)^7"):format(GetCurrentResourceName(), currentVersion))
print(("^5https://github.com/%s/releases/tag/v%s^7"):format(githubRepo, data.version))
end
end
end
end, "GET", "", "")
end)