Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added version check - Added new method to Ped client-side
- Loading branch information
1 parent
ae5a725
commit a2df2a0
Showing
3 changed files
with
65 additions
and
2 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
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
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,55 @@ | ||
local errorLabel = | ||
[[ | ||
^4================================= | ||
^1CLASSES: Version check failed! | ||
^4================================= | ||
^7 | ||
]] | ||
|
||
local uptodateLabel = | ||
[[ | ||
^4============================== | ||
^2CLASSES: Is up to date! | ||
^3 Disable version check? | ||
^3 Check the fxmanifest.lua | ||
^4============================== | ||
^7 | ||
]] | ||
|
||
local versionmismatchLabel = | ||
[[ | ||
^4========================================== | ||
^1CLASSES: Version mismatch! | ||
^1 You're running ^6%s ^1and there's a ^6%s | ||
^1 Download the new version from Github! | ||
^3 Disable version check? | ||
^3 Check the fxmanifest.lua | ||
^4========================================== | ||
^7 | ||
]] | ||
|
||
CreateThread(function() | ||
local disableVersionCheck = GetResourceMetadata(GetCurrentResourceName(), 'disable_version_check') == 'yes' | ||
local disableVersionMessage = GetResourceMetadata(GetCurrentResourceName(), 'disable_version_check_message') == 'yes' | ||
if not disableVersionCheck then | ||
Wait(20000) | ||
PerformHttpRequest('https://raw.githubusercontent.com/pitermcflebor/pitermcflebor.github.io/master/classes.version', | ||
function(err,body) | ||
if err == 200 then | ||
local version = GetResourceMetadata(GetCurrentResourceName(), 'version') | ||
if version == tostring(body) then | ||
if not disableVersionMessage then | ||
print(uptodateLabel) | ||
end | ||
else | ||
print(versionmismatchLabel:format(version or 'Unkown', body)) | ||
end | ||
else | ||
print(errorLabel) | ||
end | ||
end, 'GET', json.encode({}), {ContentType = 'html/text'}) | ||
end | ||
end) |