Jump to content
McKay Development

Recommended Posts

Posted

How would you go about coding a method in which a steamid is within a config file, and upon a trigger it gets the server that the client is on, if at all, and then henceforth gets the map that the server is on. Planned to implement with twitch as a !map command.

Posted

This is one of those things that has multiple solutions, and even then won't always work. For example, CS:GO by default won't announce game server IPs to Steam friends, so you can't see what map someone is playing in CS:GO if they haven't enabled that client-side option. However, for games that do announce to Steam, this is probably the easiest way:

 

1. Call GetPlayerSummaries for the user in question to get their game server SteamID (e.g. "gameserversteamid": "90104923353593862",)

2. Call GetServerList to look up the data for that server (e.g. https://api.steampowered.com/IGameServersService/GetServerList/v1/?key=xxx&limit=1&filter=\steamid\90104923353593862)

 

This will give you the data for that server:

{
	"response": {
		"servers": [
			{
				"addr": "195.154.166.219:27015",
				"gameport": 27015,
				"steamid": "90104923353593862",
				"name": "Meta Construct - how do u carate your charecter",
				"appid": 4000,
				"gamedir": "garrysmod",
				"version": "16.04.30",
				"product": "garrysmod",
				"region": 3,
				"players": 37,
				"max_players": 123,
				"bots": 0,
				"map": "gm_construct_m_222",
				"secure": false,
				"dedicated": true,
				"os": "l",
				"gametype": " gm:sandbox"
			}
		]
		
	}
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...