You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

43 lines
1.1 KiB

#include <sourcemod>
#include <ripext>
new HTTPClient:hSteamClient = INVALID_HANDLE;
stock void SetupBackend(const char[] address, int port, bool https=false){
if(hSteamClient != INVALID_HANDLE) CloseHandle(hSteamClient);
char url[256];
if(https){
Format(url, sizeof(url), "https://%s:%i", address, port);
} else {
Format(url, sizeof(url), "http://%s:%i", address, port);
}
PrintToServer("[SteamBackend] Setup backend on: %s", url);
hSteamClient = new HTTPClient(url);
return;
}
stock void KickClient_WithBackendMessage(int client, const char[] reason){
char auth[32];
GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth));
//////////////////////////
KickClient(client, reason);
//////////////////////////
if(hSteamClient == INVALID_HANDLE) return;
//////////////////////////
char url[256];
Format(url, 256, "show_ban/%s", auth);
hSteamClient.Get(url, SteamClient_Callback);
return;
}
static void SteamClient_Callback(HTTPResponse response, any value){
if (response.Status > 200 && response.Status < 210){
return;
} else {
PrintToServer("Failed response! Code: %i", response.Status);
return;
}
}