• Print

Author Topic: Automatically move someone to a group if they join the steam group?  (Read 15156 times)

0 Members and 1 Guest are viewing this topic.

Offline Jaden Zepeda

  • Newbie
  • *
  • Posts: 28
  • Karma: 0
Re: Automatically move someone to a group if they join the steam group?
« Reply #15 on: December 21, 2014, 05:39:36 pm »
Error, bad server command ulx adduserid STEAM_0:0:86623958 member

:/

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Automatically move someone to a group if they join the steam group?
« Reply #16 on: December 21, 2014, 05:47:14 pm »
Try RunConsoleCommand() instead.

ex: RunConsoleCommand( "ulx", "adduserid", ply:SteamID(), "member" )
« Last Edit: December 21, 2014, 05:59:07 pm by Neku »
Out of the Garry's Mod business.

Offline Jaden Zepeda

  • Newbie
  • *
  • Posts: 28
  • Karma: 0
Re: Automatically move someone to a group if they join the steam group?
« Reply #17 on: December 21, 2014, 06:10:28 pm »
This is it! Thank you everyone who helped me with this!

Code: Lua
  1. if SERVER then
  2.         function CommunityCheckStatus( ply )
  3.                 if not IsValid(ply) then return end
  4.                 local id = util.SteamIDTo64( ply:SteamID() )
  5.                 http.Fetch("http://steamcommunity.com/groups/sandboxwars/memberslistxml/?xml=1&lolwat="..os.time(),
  6.                         function( body, _, _, _ )
  7.                                 if string.find( body, id ) then
  8.                                         SetPlayerMember( ply )
  9.                                 else
  10.                                         print( "FALSE" )
  11.                                 end
  12.                         end,
  13.                         function( error )
  14.                                 print( "Something went terribly wrong!" )
  15.                                 print( error )
  16.                         end
  17.                 )
  18.         end
  19.  
  20.         function SetPlayerMember( ply )
  21.                 if not IsValid(ply) then return end
  22.         if ply:GetUserGroup() == "user" then  RunConsoleCommand( "ulx", "adduserid", ply:SteamID(), "member" ) end
  23.         end
  24.  
  25.         hook.Add("PlayerSpawn",
  26.                 "SteamGroupMemberCheck",
  27.                 function(ply)
  28.                         CommunityCheckStatus( ply )
  29.                 end)
  30. end
Once Again, thanks everyone! I can confirm this works!
« Last Edit: December 21, 2014, 06:13:13 pm by Jaden Zepeda »

  • Print