View Single Post
Author Message
Mister_Magotchi
SourceMod Donor
Join Date: Dec 2006
Location: Nampa, Idaho
Old 12-19-2010 , 22:42   Steam Group Admins (HTTP Prefetch)
Reply With Quote #1

Steam Group Admins (HTTP Prefetch)

This plugin reads all players from Steam Community group XML member lists (via HTTP), based on a config file, and adds them to the admin cache whenever the admin cache is refreshed (manually or at map start).

It should work in any game that SourceMod supports.

I've currently used it on a Windows CS:S server, a Linux CS:S server, a Windows TF2 server, and a Windows CS:GO server.

Setup:
  1. Install the cURL extension.
  2. Extract the attached ZIP archive to your game mod folder.
  3. Edit addons\sourcemod\configs\steam-group-admins-http.txt to you liking. All entries are commented out by default.
    • Steam group ID (the key name for each entry)
      • This may be found most easily by going to "Admin options" --> "Edit group profile" when viewing a group you are an admin for in the Steam Community. It can also be found by subtracting 103582791429521408 from the groupid64 if you know that. You can see the groupid64 for all the groups a player is in by tacking "?xml=1" onto the end of their Steam Community profile URL (eg http://steamcommunity.com/id/ChetFaliszek?xml=1) and viewing the XML source.
    • admin_group_name - Required
      • The name you want SourceMod to use as its admin group name. If you have already created the group with another admin config. system, this plugin will use that group. If not, this plugin will create it.
    • flags - Optional
      • Flags to add to the group. If you are using a pre-existing group name from another admin config. system, these flags will be added to all members of that group. If you already have the flags set for the group with the other system, you don't need to set them here.
    • immunity - Optional
      • If set, the group's immunity level will be set to this. If you already have the immunity set for the group via another admin config. system, setting it here may overwrite the other value, depending on the order in which the plugins work with the admin cache.
  4. Change the map or restart your server. You can alternatively manually load the plugin and then run sm_reloadadmins.
Version History:
  • 0.9.0 - 2010-12-19 - Initial release
  • 0.9.5 - 2012-02-25 - Nearly complete rewrite. Switched from Socket to cURL. Fixed intermittent crash on map change. Fixed invalid memory access errors.
  • 0.9.6 - 2012-04-23 - Added caching: XML files are now written to the SM data folder before being read, so for later admin cache reloads, if cURL can't get fresh data from Steam's servers, it still has old data to work with.
  • 0.9.7 - 2012-04-28 - Fixed minor corruption of XML cache data, and players potentially not being properly removed as admins, when users were removed from a Steam group.
  • 0.9.8 - 2013-12-28 - Changed the way API data caching works to hopefully do away with file-locking issues experienced by some. Also, no response from the API will be cached unless it contains valid group member data; this should prevent people from losing their admin rights when Steam's API is providing abnormal data.
  • 0.9.9 - 2013-12-30 - Made SteamID64 to Steam ID conversion more future-proof, fixed calculation error which may have affected a small percentage of Steam IDs, cleaned up and better-documented code.
  • 0.9.9b - 2014-08-26 - Hotfix to support new Steam ID format ("[U:1:########]").
Known Issues:

When manually reloading the admin cache via sm_reloadadmins, players currently authenticated as admins via this plugin will lose their admin authentication until they reconnect to the server or the map changes.

Steam Community group XML member lists are paginated after 1,000 members, so in order to prevent excessive server load and hammering of the Steam Community XML API, only the first page, and therefore only the first 1,000 listed members, are processed.

Special Thanks:

psychonic - He made the original Steam Group Admins plugin. As there is a slight delay after a user connects to the server before they are authenticated by their Steam groups, it doesn't work properly for reserved slots, and that's why I made this plugin. His plugin, however, supports groups of any size, while mine only handles groups with 1,000 members or less.

Compiling:

This plugin requires the include files for the cURL extension to compile correctly.

Download Options:
  • steam-group-admins-http-new-steamid-format.zip
    • Adds admins using the new Steam ID format ("[U:1:########]").
    • Only works in 1.7 branch of SourceMod.
    • Requires a game which uses the new format, like TF2.
  • steam-group-admins-http-old-steamid-format.zip
    • Adds admins using the old Steam ID format ("STEAM_0:#:########").
    • Only works in 1.6 branch of SourceMod.
    • Works with games that use either the new or old Steam ID formats, thanks to the 1.6 branch backward compatibility "hack" on 2014-08-21.
Attached Files
File Type: zip steam-group-admins-http-old-steamid-format.zip (11.2 KB, 1173 views)
File Type: zip steam-group-admins-http-new-steamid-format.zip (11.2 KB, 2265 views)

Last edited by Mister_Magotchi; 09-08-2014 at 22:30.
Mister_Magotchi is offline