• Print

Author Topic: Using Steamworks to check if a player is a member of your steam community group.  (Read 5905 times)

0 Members and 1 Guest are viewing this topic.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Here is a little wrapper I wrote that checks either a player or a SteamID to see if they exist inside of Steam Community Group.

This does very little on its own, but you could very easily modify this to do all kinds of things, including basic ULX group authentication for setting players to member... or whatever you want.

Code: Lua
  1. function CommunityCheckStatus( communityID, ply )
  2.         if not IsValid(ply) then return end
  3.         local id = util.SteamIDTo64( ply:SteamID() )
  4.         http.Fetch( "http://steamcommunity.com/groups/" .. communityID .. "/memberslistxml/?xml=1?lolwat="..os.time(),
  5.                 function( body, _, _, _ )
  6.                         if string.find( body, id ) then
  7.                                 SetPlayerMember( ply )
  8.                         else
  9.                                 print( "FALSE" )
  10.                         end
  11.                 end,
  12.                 function( error )
  13.                         print( "Something went terribly wrong!" )
  14.                         print( error )
  15.                 end
  16.         )
  17. end
  18.  
  19. function CommunityCheckStatusID( communityID, sid )
  20.         local id = util.SteamIDTo64( sid )
  21.         http.Fetch( "http://steamcommunity.com/groups/" .. communityID .. "/memberslistxml/?xml=1?lolwat="..os.time(),
  22.                 function( body, _, _, _ )
  23.                         if string.find( body, id ) then
  24.                                 SetPlayerMemberID( id )
  25.                         else
  26.                                 print( "FALSE" )
  27.                         end
  28.                 end,
  29.                 function( error )
  30.                         print( "Something went terribly wrong!" )
  31.                         print( error )
  32.                 end
  33.         )
  34. end
  35.  
  36. function SetPlayerMember( ply )
  37.         if not IsValid(ply) then return end
  38.         print( "THIS PLAYER IS A MEMBER!")
  39. end
  40.  
  41. function SetPlayerMemberID( id )
  42.         print( "THIS PLAYER IS A MEMBER!")
  43. end
  44.  

  • Print