reverting addition

This commit is contained in:
Christian 2021-02-20 22:19:24 +01:00
parent 3d8c29baff
commit f023abde25

View File

@ -118,38 +118,13 @@ public void OnClientAuthorized(int client, const char[] sSteamID32)
{ {
if (IsFakeClient(client)) if (IsFakeClient(client))
return; return;
DataPack hDataPack = new DataPack();
hDataPack.WriteCell(client);
hDataPack.WriteString(sSteamID32);
float duration = GetRandomFloat(1.0, 2.5);
CreateTimer(duration, Timer_do_https_request, hDataPack);
}
stock bool IsValidClient(int client)
{
if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client))
{
return true;
}
return false;
}
public Action Timer_do_https_request(Handle timer, DataPack pack)
{
pack.Reset();
int client = pack.ReadCell();
if (IsValidClient(client))
{
char sSteamID32[32];
pack.ReadString(sSteamID32, sizeof(sSteamID32));
char sSteamID64[32]; char sSteamID64[32];
SteamID32toSteamID64(sSteamID32, sSteamID64, sizeof(sSteamID64)); SteamID32toSteamID64(sSteamID32, sSteamID64, sizeof(sSteamID64));
int iSerial = GetClientSerial(client);
char sRequest[256]; char sRequest[256];
FormatEx(sRequest, sizeof(sRequest), "https://unloze.com/api/private_api.php?api_key=%s&steam_id=%s", UNLOZE_APIKEY, sSteamID64); FormatEx(sRequest, sizeof(sRequest), "https://unloze.com/api/private_api.php?api_key=%s&steam_id=%s", UNLOZE_APIKEY, sSteamID64);
int iSerial = GetClientSerial(client);
Handle hRequest = SteamWorks_CreateHTTPRequest(k_EHTTPMethodGET, sRequest); Handle hRequest = SteamWorks_CreateHTTPRequest(k_EHTTPMethodGET, sRequest);
if (!hRequest || if (!hRequest ||
!SteamWorks_SetHTTPCallbacks(hRequest, OnClientAuthorized_OnTransferComplete) || !SteamWorks_SetHTTPCallbacks(hRequest, OnClientAuthorized_OnTransferComplete) ||
@ -159,9 +134,6 @@ public Action Timer_do_https_request(Handle timer, DataPack pack)
delete hRequest; delete hRequest;
} }
} }
delete pack;
return Plugin_Handled;
}
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose: