-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4000b2d
commit 86c8b1a
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
AddEventHandler('onResourceStart', function(resource) | ||
if resource == GetCurrentResourceName() then | ||
zapsupdatee() | ||
|
||
if resource == 'RedTrainer' then | ||
|
||
else | ||
print("^1[ERROR] Please rename your resource to RedTrainer") | ||
end | ||
end | ||
end) | ||
|
||
function zapsupdatee() | ||
local githubRawUrl = "https://raw.githubusercontent.com/Zaps6000/base/main/api.json" | ||
local resourceName = "RedTrainer" | ||
|
||
PerformHttpRequest(githubRawUrl, function(statusCode, responseText, headers) | ||
if statusCode == 200 then | ||
local responseData = json.decode(responseText) | ||
|
||
if responseData[resourceName] then | ||
local remoteVersion = responseData[resourceName].version | ||
local description = responseData[resourceName].description | ||
local changelog = responseData[resourceName].changelog | ||
|
||
local manifestVersion = GetResourceMetadata(GetCurrentResourceName(), "version", 0) | ||
|
||
print("Resource: " .. resourceName) | ||
print("Manifest Version: " .. manifestVersion) | ||
print("Remote Version: " .. remoteVersion) | ||
print("Description: " .. description) | ||
|
||
if manifestVersion ~= remoteVersion then | ||
print("Status: Out of Date (New Version: " .. remoteVersion .. ")") | ||
print("Changelog:") | ||
for _, change in ipairs(changelog) do | ||
print("- " .. change) | ||
end | ||
print("Link to Updates: https://discord.gg/cfxdev") | ||
else | ||
print("Status: Up to Date") | ||
end | ||
else | ||
print("Resource name not found in the response.") | ||
end | ||
else | ||
print("HTTP request failed with status code: " .. statusCode) | ||
end | ||
end, "GET", nil, json.encode({}), {}) | ||
end | ||
|
||
|
||
|
||
|