Raised This Month: $204 Target: $400
 51% 

[ANY] SteamWorks


Post New Thread Reply   
 
Thread Tools Display Modes
JLmelenchon
Member
Join Date: Mar 2019
Old 02-02-2020 , 16:05   Re: [ANY] SteamWorks
Reply With Quote #731

I have a similar problem but i installed the linux version on a linux server, was working the other day and it just stopped.

Last edited by JLmelenchon; 02-02-2020 at 16:05.
JLmelenchon is offline
JLmelenchon
Member
Join Date: Mar 2019
Old 02-04-2020 , 02:05   Re: [ANY] SteamWorks
Reply With Quote #732

Ok i had to do "sm exts load SteamWorks", why it does not load automatically when server launch ??? I have installed all files.

edit: solved with SteamWorks.autoload file

Last edited by JLmelenchon; 02-04-2020 at 02:52.
JLmelenchon is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 02-04-2020 , 04:25   Re: [ANY] SteamWorks
Reply With Quote #733

Extensions are loaded automatically when a plugin needs them, it won’t be loaded unless you have a plugin that wants to use it.
__________________
asherkin is offline
vn_lind
Member
Join Date: Jul 2017
Old 02-11-2020 , 09:23   Re: [ANY] SteamWorks
Reply With Quote #734

i tried the latest version on my css server but it crashes the server ,, any ideas what i have missed ?
vn_lind is offline
Vit_amin
Senior Member
Join Date: Dec 2015
Location: Russian Federation
Old 02-11-2020 , 16:49   Re: [ANY] SteamWorks
Reply With Quote #735

Native SteamWorks_SetGameDescription doesn't work in L4D2, GameDescription doesn't changed
Vit_amin is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old Yesterday , 10:09   Re: [ANY] SteamWorks
Reply With Quote #736

So, I'm not being able to send a HTTP PUT Request.

Here's my code:

Code:
public Action Event_Round_End_Post(Handle event, const char[]name, bool dontBroadcast)
{
	char link[256];
	Format(link, sizeof(link), "%s/%s", portal_url, match_id);

	char body[512];
	Format(body, sizeof(body), "{\"results\": [{\"team\": \"2\", \"score\": %d}, {\"team\": \"3\", \"score\": %d}]}", GetTeamScore(CS_TEAM_T), GetTeamScore(CS_TEAM_CT));

	Handle req = SteamWorks_CreateHTTPRequest(k_EHTTPMethodPUT, link);
	SteamWorks_SetHTTPRequestHeaderValue(req, "Content-Type", "application/json");
	SteamWorks_SetHTTPRequestRawPostBody(req, "application/json", body, strlen(body)sizeof(body)); // found the mistake, should be strlen() instead of sizeof()
	SteamWorks_SetHTTPCallbacks(req, OnRequestComplete_RoundEnd);
	SteamWorks_SendHTTPRequest(req);
}

public int OnRequestComplete_RoundEnd(Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode)
{
	Log("RoundEnd request complete.");

	int length;
	SteamWorks_GetHTTPResponseBodySize(hRequest, length);
	char[] body = new char[length];
	SteamWorks_GetHTTPResponseBodyData(hRequest, body, length);

	Log("Response:");
	Log(body);
}
Here's the response logged:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>400 Bad Request</title>
<h1>Bad Request</h1>
<p>The browser (or proxy) sent a request that this server could not understand.</p>
I have already tried to log the body and copy it to test using Postman, there it works fine. I have checked and the right header is just "Content-Type", "application/json", and my body is JSON format.

Any help is appreciated.

Last edited by joao7yt; Today at 17:10.
joao7yt is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old Today , 17:07   Re: [ANY] SteamWorks
Reply With Quote #737

Quote:
Originally Posted by joao7yt View Post
So, I'm not being able to send a HTTP PUT Request.

Here's my code:

Code:
public Action Event_Round_End_Post(Handle event, const char[]name, bool dontBroadcast)
{
	char link[256];
	Format(link, sizeof(link), "%s/%s", portal_url, match_id);

	char body[512];
	Format(body, sizeof(body), "{\"results\": [{\"team\": \"2\", \"score\": %d}, {\"team\": \"3\", \"score\": %d}]}", GetTeamScore(CS_TEAM_T), GetTeamScore(CS_TEAM_CT));

	Handle req = SteamWorks_CreateHTTPRequest(k_EHTTPMethodPUT, link);
	SteamWorks_SetHTTPRequestHeaderValue(req, "Content-Type", "application/json");
	SteamWorks_SetHTTPRequestRawPostBody(req, "application/json", body, sizeof(body));
	SteamWorks_SetHTTPCallbacks(req, OnRequestComplete_RoundEnd);
	SteamWorks_SendHTTPRequest(req);
}

public int OnRequestComplete_RoundEnd(Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode)
{
	Log("RoundEnd request complete.");

	int length;
	SteamWorks_GetHTTPResponseBodySize(hRequest, length);
	char[] body = new char[length];
	SteamWorks_GetHTTPResponseBodyData(hRequest, body, length);

	Log("Response:");
	Log(body);
}
Here's the response logged:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>400 Bad Request</title>
<h1>Bad Request</h1>
<p>The browser (or proxy) sent a request that this server could not understand.</p>
I have already tried to log the body and copy it to test using Postman, there it works fine. I have checked and the right header is just "Content-Type", "application/json", and my body is JSON format.

Any help is appreciated.
Found my mistake, I was using 'sizeof(body)' instead of 'strlen(body)'...
joao7yt 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 18:37.


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