Okay, thanks. I changed the output of the api-response. Now it is short enough.
But I have still one problem with the callbacks. I need the client from thi intial call. I don't get how to transport the client data.
Code:
#pragma semicolon 1
#include <sourcemod>
#include <SteamWorks>
#define MAX_STEAMID_LENGTH 21
#define MAX_COMMUNITYID_LENGTH 18
new String:g_address[] = "https://httpapirequest.org/api/user/";
new String:g_complete[256];
public OnPluginStart()
{
RegConsoleCmd("sm_api", CMD_API);
}
public Action:CMD_API(int client, int args)
{
new String:SteamID[MAX_STEAMID_LENGTH];
GetClientAuthId(client, AuthId_Steam2, SteamID, sizeof(SteamID));
new String:CommunityID[MAX_COMMUNITYID_LENGTH];
GetCommunityIDString(SteamID, CommunityID, sizeof(CommunityID));
Format(g_complete,sizeof(g_complete),"%s%s",g_address,CommunityID);
ConnectApi(client);
}
public ConnectApi(client)
{
new Handle:hRequest = SteamWorks_CreateHTTPRequest(k_EHTTPMethodGET, g_Abfragekomplett);
if (!hRequest || !SteamWorks_SetHTTPCallbacks(hRequest, OnTransferComplete) || !SteamWorks_SendHTTPRequest(hRequest))
{
CloseHandle(hRequest);
}
}
public OnTransferComplete(Handle:hRequest, bool:bFailure, bool:bRequestSuccessful, EHTTPStatusCode:eStatusCode)
{
if (!bFailure && bRequestSuccessful && eStatusCode == k_EHTTPStatusCode200OK)
{
SteamWorks_GetHTTPResponseBodyCallback(hRequest, APIWebResponse);
}
CloseHandle(hRequest);
}
public APIWebResponse(const String:sData[])
{
new iPos = StrContains(sData, "true");
//in case of sucess the string contains "true"
if(iPos == -1)
{
//false
}
else
{
//true
}
//I need the <client> here
}
Could somebody help me here?