General > Developers Corner

Automatically move someone to a group if they join the steam group?

(1/4) > >>

Jaden Zepeda:
Is this possible with Lua? Automatically moving someone to a ULX group if they join my steam group?
Ulx group: member
Steam group: http://steamcommunity.com/groups/sandboxwars
If someone could write me up a quick code that would be great!

Jaden Zepeda:
I heard about a Steam callback but I still am clueless on if this is possible or not.

JamminR:
ULX forum search within Dev corner is your friend.
http://forums.ulyssesmod.net/index.php/topic,7247.0.html

Jaden Zepeda:

--- Quote from: JamminR on December 20, 2014, 09:14:53 PM ---ULX forum search within Dev corner is your friend.
http://forums.ulyssesmod.net/index.php/topic,7247.0.html

--- End quote ---

Wow Great! Sadly I'm still pretty new to Lua, so I have no Idea what function to add so they get ulx group member if they join the steam group.

Jaden Zepeda:
I thought this would work, replacing the prints with commands, didnt work...
Original:

--- Code: ---function CommunityCheckStatus( communityID, ply )
        if not IsValid(ply) then return end
        local id = util.SteamIDTo64( ply:SteamID() )
        http.Fetch( "http://steamcommunity.com/groups/sandboxwars" .. communityID .. "/memberslistxml/?xml=1?lolwat="..os.time(),
                function( body, _, _, _ )
                        if string.find( body, id ) then
                                SetPlayerMember( ply )
                        else
                                print( "FALSE" )
                        end
                end,
                function( error )
                        print( "Something went terribly wrong!" )
                        print( error )
                end
        )
end
 
function CommunityCheckStatusID( communityID, sid )
        local id = util.SteamIDTo64( sid )
        http.Fetch( "http://steamcommunity.com/groups/sandboxwars" .. communityID .. "/memberslistxml/?xml=1?lolwat="..os.time(),
                function( body, _, _, _ )
                        if string.find( body, id ) then
                                SetPlayerMemberID( id )
                        else
                                print( "FALSE" )
                        end
                end,
                function( error )
                        print( "Something went terribly wrong!" )
                        print( error )
                end
        )
end
 
function SetPlayerMember( ply )
        if not IsValid(ply) then return end
        print( "THIS PLAYER IS A MEMBER!")
end
 
function SetPlayerMemberID( id )
        print( "THIS PLAYER IS A MEMBER!")
end
--- End code ---

Modified:


--- Code: ---function CommunityCheckStatus( communityID, ply )
if not IsValid(ply) then return end
local id = util.SteamIDTo64( ply:SteamID() )
http.Fetch( "http://steamcommunity.com/groups/sandboxwars" .. communityID .. "/memberslistxml/?xml=1?lolwat="..os.time(),
function( body, _, _, _ )
if string.find( body, id ) then
SetPlayerMember( ply )
else
print( "FALSE" )
end
end,
function( error )
print( "Something went terribly wrong!" )
print( error )
end
)
end
 
function CommunityCheckStatusID( communityID, sid )
local id = util.SteamIDTo64( sid )
http.Fetch( "http://steamcommunity.com/groups/sandboxwars" .. communityID .. "/memberslistxml/?xml=1?lolwat="..os.time(),
function( body, _, _, _ )
if string.find( body, id ) then
SetPlayerMemberID( id )
else
print( "FALSE" )
end
end,
function( error )
print( "Something went terribly wrong!" )
print( error )
end
)
end
 
function SetPlayerMember( ply )
if not IsValid(ply) then return end
    RunConsoleCommand("ulx", "adduser", ply:SteamID(), "member")
end
 
function SetPlayerMemberID( id )
RunConsoleCommand("ulx", "adduser", ply:SteamID(), "member")
end
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version