This commit is contained in:
okvdai
2023-05-03 17:50:40 +02:00
parent e51386252d
commit d23d020e6a
+5 -3
View File
@@ -26,6 +26,7 @@ global table< table > globalToneAPIGamemodeMapData = {}
string prefix = "default" string prefix = "default"
string HTTPrequestURL = "default" string HTTPrequestURL = "default"
string currentVersion = "default"
int weaponEntries = 0 int weaponEntries = 0
int mapEntries = 0 int mapEntries = 0
int gamemodeEntries = 0 int gamemodeEntries = 0
@@ -35,6 +36,7 @@ void function pulseInit()
{ {
prefix = "\x1b[38;2;255;178;102m[PULSE]\x1b[0m " prefix = "\x1b[38;2;255;178;102m[PULSE]\x1b[0m "
HTTPrequestURL = GetConVarString("ToneURL") HTTPrequestURL = GetConVarString("ToneURL")
currentVersion = "v" + GetConVarString("MajorVersion") + "." + GetConVarString("MinorVersion") + "." + GetConVarString("PatchVersion")
HttpRequest getVersion HttpRequest getVersion
getVersion.method = HttpRequestMethod.GET getVersion.method = HttpRequestMethod.GET
getVersion.url = GetConVarString("VersionURL") getVersion.url = GetConVarString("VersionURL")
@@ -42,14 +44,14 @@ void function pulseInit()
{ {
table JSONDecoded = DecodeJSON(response.body) table JSONDecoded = DecodeJSON(response.body)
if (JSONDecoded["Major"] == GetConVarString("MajorVersion") && JSONDecoded["Minor"] == GetConVarString("MinorVersion") && JSONDecoded["Patch"] == GetConVarString("PatchVersion")) { if (JSONDecoded["Major"] == GetConVarString("MajorVersion") && JSONDecoded["Minor"] == GetConVarString("MinorVersion") && JSONDecoded["Patch"] == GetConVarString("PatchVersion")) {
print(prefix + "v1.2.1 has been loaded and is up to date.") print(prefix + currentVersion + " has been loaded and is up to date.")
} else { } else {
print(prefix + "v1.2.1 has been loaded. Recommend updating to latest version: v" + JSONDecoded["Major"] + "." + JSONDecoded["Minor"] + "." + JSONDecoded["Patch"] + ".") print(prefix + currentVersion + " has been loaded. Recommend updating to latest version: v" + JSONDecoded["Major"] + "." + JSONDecoded["Minor"] + "." + JSONDecoded["Patch"] + ".")
} }
} }
void functionref(HttpRequestFailure) onFailure = void function(HttpRequestFailure failure) void functionref(HttpRequestFailure) onFailure = void function(HttpRequestFailure failure)
{ {
print(prefix + "v1.2.1 has been loaded and has encountered an error getting latest version data.") print(prefix + currentVersion + " has been loaded and has encountered an error getting latest version data.")
} }
NSHttpRequest(getVersion, onSuccess, onFailure) NSHttpRequest(getVersion, onSuccess, onFailure)
} }