Raised This Month: $71 Target: $400
 17% 

[ANY] SteamWorks


Post New Thread Reply   
 
Thread Tools Display Modes
Statik
New Member
Join Date: Apr 2014
Old 08-07-2017 , 22:35   Re: [ANY] SteamWorks
Reply With Quote #601

Quote:
Originally Posted by KyleS View Post
Is there a WasTimedOut native? If not I can add it np.
I dont see one, i've also tried with k_EResultTimeout but the tags don't match so i suposse thats not how to do it

It would be awesome if you could add that native!
Statik is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 08-09-2017 , 16:25   Re: [ANY] SteamWorks
Reply With Quote #602

Quote:
Originally Posted by Statik View Post
I dont see one, i've also tried with k_EResultTimeout but the tags don't match so i suposse thats not how to do it

It would be awesome if you could add that native!
I'm at Ti7 but I hit the beer garden to add these natives; maybe. Heading back in, if git122 pops up give it a go, if it doesn't; well... later on in the week.

Cheers.
KyleS is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 08-09-2017 , 19:02   Re: [ANY] SteamWorks
Reply With Quote #603

There were a couple issues because there hasn't been a build for almost a year, but the new member functions are now present on Linux.
KyleS is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 08-09-2017 , 21:23   Re: [ANY] SteamWorks
Reply With Quote #604

Quote:
Originally Posted by Deathknife View Post
Cheap workaround for "non-threaded call" (Wouldn't recommend ever doing this though)
PHP Code:
Handle request SteamWorks_CreateHTTPRequest(k_EHTTPMethodGET"https://www.google.com");
SteamWorks_SetHTTPCallbacks(requestHTTPCompletedINVALID_FUNCTIONHTTPReceive);

SteamWorks_SendHTTPRequest(request);
int p 0;
SteamWorks_GetHTTPResponseBodySize(requestp);
while(
== 0) {
    
SteamWorks_GetHTTPResponseBodySize(requestp);

the events are fired the next tick, but it's ready to use and you can get response data with callback easily after the while loop ends.
PHP Code:
SteamWorks_GetHTTPResponseBodyCallback(requestfCallbackdata); 
If the target url returns a blank page or is unreachable your gameserver is fucked
__________________
zipcore is offline
Statik
New Member
Join Date: Apr 2014
Old 08-10-2017 , 12:38   Re: [ANY] SteamWorks
Reply With Quote #605

Quote:
Originally Posted by KyleS View Post
I'm at Ti7 but I hit the beer garden to add these natives; maybe. Heading back in, if git122 pops up give it a go, if it doesn't; well... later on in the week.

Cheers.
Thanks mate, take your time and enjoy
Statik is offline
xxxhooligan
New Member
Join Date: Jul 2017
Old 08-14-2017 , 10:38   Re: [ANY] SteamWorks
Reply With Quote #606

Guys, Idk what happens, but my server does not allow anyone to connect when I'm using steamwork.
I tried to install latest release (from 9th of august). When I deleted and restarted, eeryone were able to connect to it again.

The error was something with lobbies like this server uses x lobbies or something.
I'm using linux build, non steam (maybe revemu is the issue?)
What can I do to fix it?
xxxhooligan is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 08-14-2017 , 11:07   Re: [ANY] SteamWorks
Reply With Quote #607

Quote:
Originally Posted by xxxhooligan View Post
I'm using linux build, non steam (maybe revemu is the issue?)
Yes, this is probably the cause of your problem.

We do not support piracy here, please read the forum rules.
__________________
asherkin is offline
ReymonARG
Junior Member
Join Date: Jun 2017
Old 08-17-2017 , 14:12   Re: [ANY] SteamWorks
Reply With Quote #608

Someone try a good method for send a file to a remote host? Now I am setting the file with RawPost
ReymonARG is offline
dubbeh
Senior Member
Join Date: Jul 2007
Old 08-17-2017 , 15:46   Re: [ANY] SteamWorks
Reply With Quote #609

Came accross an issue, that I'm a bit stumped about because it's working perfectly for me.

https://github.com/dubbeh/motd-fixer...df/register.sp

Full Source:
Code:
public Action Command_MOTDRegisterServer(int iClient, int iArgs)
{
	char szRegisterURL[192] = "";
	Handle hHTTPRequest = INVALID_HANDLE;
	
	if (g_cVarEnable.BoolValue)
	{
		if (g_cVarValidateType.IntValue == VALIDATE_TOKEN)
		{
			if (SteamWorks_IsLoaded())
			{
				Format(szRegisterURL, sizeof(szRegisterURL), "%s?server=1", g_szRegisterURL);
				if ((hHTTPRequest = SteamWorks_CreateHTTPRequest(k_EHTTPMethodPOST, szRegisterURL)) != INVALID_HANDLE)
				{
					if (SetServerInfoPostData(hHTTPRequest) &&
						SteamWorks_SetHTTPCallbacks(hHTTPRequest, SteamWorks_OnRegisterComplete) &&
						SteamWorks_SendHTTPRequest(hHTTPRequest))
					{
						MOTDFLogMessage("Registering server.");
					} else {
						MOTDFLogMessage("Error setting HTTP request data for server registration.");
					}
				}
			} else {
				SetFailState("SteamWorks doesn't appear to be loaded. Make sure to have it installed and running first.");
			}
		} else {
			ReplyToCommand(iClient, "No need to register under IP based validation");
		}
	}
}

public void SteamWorks_OnRegisterComplete(Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode)
{
	char szResponseData[512] = "";
	int iResponseSize = 0;
	char szJSONResMsg[512];
	bool bIsBlocked = false;
	
	if (!bFailure && bRequestSuccessful && eStatusCode == k_EHTTPStatusCode200OK)
	{
		if (SteamWorks_GetHTTPResponseBodySize(hRequest, iResponseSize) && SteamWorks_GetHTTPResponseBodyData(hRequest, szResponseData, iResponseSize))
		{
			MOTDFLogMessage("SteamWorks_OnRegisterComplete() JSON Response: %s", szResponseData);
			if (ReadJSONResponse(szResponseData, szJSONResMsg, sizeof(szJSONResMsg), bIsBlocked, g_szServerToken, sizeof(g_szServerToken)))
			{
				MOTDFLogMessage(szJSONResMsg);
				if (g_szServerToken[0])
				{
					cfg.Save();
				}
			} else {
				MOTDFLogMessage("SteamWorks_OnRegisterComplete() Error: %s - IsBlocked: %s", szJSONResMsg, bIsBlocked ? "TRUE" : "FALSE");
			}
		} else {
			MOTDFLogMessage("SteamWorks_OnRegisterComplete() Error retrieving registration response data.");
		}
	} else {
		MOTDFLogMessage("SteamWorks_OnRegisterComplete() Error: Response code %d .", eStatusCode);
	}

	CloseHandle(hRequest);
}
What's basically happening - They're getting to
Code:
MOTDFLogMessage("Registering server.");
but nothing after that point.

Was thinking if it was a CloudFlare issue possibly? but it's working fine for me without problems but that's testing on a residential IP.

Hopefully someone has possible ideas on the cause,

Thanks

Edit:
They're using NFO Servers as the host - if that helps.
__________________
SM Plugins - dubbeh.net - Plugin requests are welcome

Last edited by dubbeh; 08-17-2017 at 15:48.
dubbeh is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 08-17-2017 , 18:59   Re: [ANY] SteamWorks
Reply With Quote #610

Quote:
Originally Posted by dubbeh View Post
Came accross an issue, that I'm a bit stumped about because it's working perfectly for me.

https://github.com/dubbeh/motd-fixer...df/register.sp

Full Source:
Code:
public Action Command_MOTDRegisterServer(int iClient, int iArgs)
{
	char szRegisterURL[192] = "";
	Handle hHTTPRequest = INVALID_HANDLE;
	
	if (g_cVarEnable.BoolValue)
	{
		if (g_cVarValidateType.IntValue == VALIDATE_TOKEN)
		{
			if (SteamWorks_IsLoaded())
			{
				Format(szRegisterURL, sizeof(szRegisterURL), "%s?server=1", g_szRegisterURL);
				if ((hHTTPRequest = SteamWorks_CreateHTTPRequest(k_EHTTPMethodPOST, szRegisterURL)) != INVALID_HANDLE)
				{
					if (SetServerInfoPostData(hHTTPRequest) &&
						SteamWorks_SetHTTPCallbacks(hHTTPRequest, SteamWorks_OnRegisterComplete) &&
						SteamWorks_SendHTTPRequest(hHTTPRequest))
					{
						MOTDFLogMessage("Registering server.");
					} else {
						MOTDFLogMessage("Error setting HTTP request data for server registration.");
					}
				}
			} else {
				SetFailState("SteamWorks doesn't appear to be loaded. Make sure to have it installed and running first.");
			}
		} else {
			ReplyToCommand(iClient, "No need to register under IP based validation");
		}
	}
}

public void SteamWorks_OnRegisterComplete(Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode)
{
	char szResponseData[512] = "";
	int iResponseSize = 0;
	char szJSONResMsg[512];
	bool bIsBlocked = false;
	
	if (!bFailure && bRequestSuccessful && eStatusCode == k_EHTTPStatusCode200OK)
	{
		if (SteamWorks_GetHTTPResponseBodySize(hRequest, iResponseSize) && SteamWorks_GetHTTPResponseBodyData(hRequest, szResponseData, iResponseSize))
		{
			MOTDFLogMessage("SteamWorks_OnRegisterComplete() JSON Response: %s", szResponseData);
			if (ReadJSONResponse(szResponseData, szJSONResMsg, sizeof(szJSONResMsg), bIsBlocked, g_szServerToken, sizeof(g_szServerToken)))
			{
				MOTDFLogMessage(szJSONResMsg);
				if (g_szServerToken[0])
				{
					cfg.Save();
				}
			} else {
				MOTDFLogMessage("SteamWorks_OnRegisterComplete() Error: %s - IsBlocked: %s", szJSONResMsg, bIsBlocked ? "TRUE" : "FALSE");
			}
		} else {
			MOTDFLogMessage("SteamWorks_OnRegisterComplete() Error retrieving registration response data.");
		}
	} else {
		MOTDFLogMessage("SteamWorks_OnRegisterComplete() Error: Response code %d .", eStatusCode);
	}

	CloseHandle(hRequest);
}
What's basically happening - They're getting to
Code:
MOTDFLogMessage("Registering server.");
but nothing after that point.

Was thinking if it was a CloudFlare issue possibly? but it's working fine for me without problems but that's testing on a residential IP.

Hopefully someone has possible ideas on the cause,

Thanks

Edit:
They're using NFO Servers as the host - if that helps.
Slew of issues...

You're not returning Plugin_Handled in your command callback.
Is this timing out? Try setting SteamWorks_SetHTTPRequestNetworkActivityTimeo ut.
You're raw printing strings and double formatting strings, MOTDFLogMessage(szJSONResMsg); is a disaster.
Your SteamWorks_IsLoaded() call is wrong and you should be using GetFeatureStatus.
Have you checked your SM error logs?
KyleS is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:13.


Powered by vBulletin®
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Theme made by Freecode