AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   [ANY] SteamWorks (https://forums.alliedmods.net/showthread.php?t=229556)

Statik 08-07-2017 22:35

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KyleS (Post 2540178)
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 :P

It would be awesome if you could add that native!

KyleS 08-09-2017 16:25

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by Statik (Post 2540198)
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 :P

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 08-09-2017 19:02

Re: [ANY] SteamWorks
 
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.

zipcore 08-09-2017 21:23

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by Deathknife (Post 2534976)
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 :D

Statik 08-10-2017 12:38

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KyleS (Post 2540604)
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 :)

xxxhooligan 08-14-2017 10:38

Re: [ANY] SteamWorks
 
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?

asherkin 08-14-2017 11:07

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by xxxhooligan (Post 2541519)
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.

ReymonARG 08-17-2017 14:12

Re: [ANY] SteamWorks
 
Someone try a good method for send a file to a remote host? Now I am setting the file with RawPost

dubbeh 08-17-2017 15:46

Re: [ANY] SteamWorks
 
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.

KyleS 08-17-2017 18:59

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by dubbeh (Post 2542196)
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?


All times are GMT -4. The time now is 09:28.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.