View Single Post
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 07-06-2017 , 19:41   Re: Plugin that checks steam profiles and warns/kicks private profile holders
Reply With Quote #20

Quote:
Originally Posted by WatchDogs View Post
A help request please:

I received a private message from someone that plugin doesn't works.
I edited it and added some debug logs. The problem is from Body Size value (iBodySize in plugin).
It doesn't returns 0 when client profile is private so plugin does not detects it's private!
Yep, the stuff I also mentioned in the post above.

Game ID is not required to check profile status, so throw it away.

Code:
https://steamapi.darkserv.download/public/
Send steamID64 with the steamID64 to this one, e.g.:

Code:
	if(GetClientAuthId(client, AuthId_SteamID64, steamId[client], 32))
and
Code:
public void SendRequest(int client, char[] steamID64)
{
[...]
	SteamWorks_SetHTTPRequestGetOrPostParameter(hRequest, "steamID64", steamID64);
Private profile:
Code:
$ curl -s -D - -o - "https://steamapi.darkserv.download/public/?steamID64=76561197961798171"
HTTP/1.1 406 Not Acceptable
Public profile:
Code:
$ curl -s -D - -o - "https://steamapi.darkserv.download/public/?steamID64=76561197961798171"
HTTP/1.1 202 Accepted
then the HTTP callback could be like this:

Code:
public HTTP_RequestComplete(Handle HTTPRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode, any userid)
{
	int client = GetClientOfUserId(userid);

	PrintToServer("HTTP Request call back =>> client %i, UserID: %i, eStatusCode: %d, bRequestSuccessful: %i", client, userid, eStatusCode, bRequestSuccessful);

	if(bRequestSuccessful)
	{
		if(eStatusCode == k_EHTTPStatusCode202Accepted) {
			/* 202 Accepted	           == Steam Profile is PUBLIC */
			PrintToServer("Yes: %N has a PUBLIC profile.", client);
		}
		else if(eStatusCode == k_EHTTPStatusCode406NotAcceptable) {
		{
			/* 406 Not Acceptable      == Steam Profile is PRIVATE */
			PrintToServer("NO : %N has a PRIVATE profile.", client);
		}
		if(eStatusCode == k_EHTTPStatusCode503ServiceUnavailable) {
			/* 503 Service Unavailable == Steam network is down, or some connectivity issues; try again in a minute or two? */
			PrintToServer("BOO: %N checking failed, please try again later...", client);
		}
	}
}
  • A status code of "202 Accepted" means that the Steam ID has a PUBLIC profile.
  • A status code of "406 Not Acceptable" means that the Steam ID has a PRIVATE profile.
  • Any other codes would normally indicate that there was an error during the lookup.
    And in that case, I suggest you wait a minute or two and then re-try the API call.

Quote:
Originally Posted by WatchDogs View Post
Here I uploaded the new source: https://github.com/WatchDogsDev/Test
Hrmf, somehow, I like the code in post #6 better than the GitHub one.

Quote:
Originally Posted by Obyboby View Post
Well then thanks for doing this!
NP!
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].

Last edited by DarkDeviL; 07-06-2017 at 20:18.
DarkDeviL is offline