Skip to content

Instantly share code, notes, and snippets.

@andiskiy
Created March 6, 2020 14:57
Show Gist options
  • Save andiskiy/6db908086be042bd2cae75ca7b9cc055 to your computer and use it in GitHub Desktop.
Save andiskiy/6db908086be042bd2cae75ca7b9cc055 to your computer and use it in GitHub Desktop.
HTTPClient hHTTPClient = new HTTPClient("https://lvl.io/api/v1/servers");
JSONObject hJSONObject = new JSONObject();
hJSONObject.SetInt("score_first_team", g_iScores[0]);
hJSONObject.SetInt("score_second_team", g_iScores[1]);
char sID[64];
for (int i = 1; i <= MaxClients; ++i)
{
if(IsClientInGame(i) && !IsFakeClient(i))
{
GetClientAuthId(i, AuthId_SteamID64, sID, sizeof(sID));
JSONArray hJSONArray = new JSONArray();
JSONObject statsJSONObject = new JSONObject();
statsJSONObject.SetInt("kills", g_Stats_iKills[i]);
statsJSONObject.SetInt("deaths", g_Stats_iDeaths[i]);
statsJSONObject.SetInt("assist", g_Stats_iAssist[i]);
statsJSONObject.SetInt("hs", g_Stats_iHS[i]);
statsJSONObject.SetInt("fk", g_Stats_iFK[i]);
statsJSONObject.SetInt("two_kills", g_Stats_iTwoKills[i]);
statsJSONObject.SetInt("three_kills", g_Stats_iThreeKills[i]);
statsJSONObject.SetInt("four_kills", g_Stats_iFourKills[i]);
statsJSONObject.SetInt("five_kills", g_Stats_iFiveKills[i]);
statsJSONObject.SetInt("round_kills", g_Stats_iRoundKills[i]);
hJSONArray.PushInt(statsJSONObject);
hJSONObject.Set(sID, hJSONArray);
delete hJSONArray;
}
}
hHTTPClient.Post("stats", hJSONObject, OnHTTPResponse, 3);
delete hJSONObject;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment