handle kill endpoint errors

This commit is contained in:
2023-03-03 20:13:38 +01:00
parent a1e591b5f5
commit 6d52c8cfab
2 changed files with 19 additions and 7 deletions
+17 -3
View File
@@ -184,8 +184,22 @@ void function killstat_Record(entity victim, entity attacker, var damageInfo) {
values["distance"] <- format("%.3f", dist)
string json = EncodeJSON(values)
print("sending here... I realise")
NSHttpPostBody(GetToneURIWithAuth()+ "/servers/"+file.Tone_ID+"/kill", json)
void functionref( HttpRequestResponse ) onSuccess = void function ( HttpRequestResponse response )
{
if(response.statusCode == 200 || response.statusCode == 201){
print("[Tone API] Kill data sent!")
}else{
print("[Tone API][WARN] Couldn't send kill data")
print("[Tone API][WARN] " + response.body )
}
}
void functionref( HttpRequestFailure ) onFailure = void function ( HttpRequestFailure failure )
{
print("[Tone API][WARN] Couldn't send kill data")
print("[Tone API][WARN] " + failure.errorMessage )
}
NSHttpPostBody(GetToneURIWithAuth()+ "/servers/"+file.Tone_ID+"/kill", json, onSuccess, onFailure)
}
void function killstat_End() {
@@ -332,7 +346,7 @@ void function Tone_Test_Auth(){
HttpRequest request
request.method = HttpRequestMethod.POST
request.url = GetToneURIWithAuth() + "/servers/"+file.Tone_ID
//print(GetToneURIWithAuth())
print(GetToneURIWithAuth())
void functionref( HttpRequestResponse ) onSuccess = void function ( HttpRequestResponse response )
{
if(response.statusCode == 200){