Ulysses

General => Developers Corner => Topic started by: BigBrainAFK on April 09, 2015, 01:23:44 PM

Title: Add user to group via lua
Post by: BigBrainAFK on April 09, 2015, 01:23:44 PM
Hello,

I'm working on a TTT server and I have the problem that i don't know how to add a user in ulx to a usergroup via lua script say for example like in an achievement system or something like that.

As far as I know it doesn't work via ply:SetUserGroup so how should i do it then?


P.S.: It would be cool if it says "(Someone) added *INSERT NAME HERE* to *INSERT GROUP HERE*" like if a real admin adds the player
Title: Re: Add user to group via lua
Post by: Aaron113 on April 09, 2015, 01:33:42 PM
Why don't you just run the already existing command (ulx adduser) using RunConsoleCommand()?
Title: Re: Add user to group via lua
Post by: BigBrainAFK on April 09, 2015, 01:45:26 PM
I kind of remember that I saw a thread already talking about RunConsoleCommand and how it don't work with ULX but i think i give it a try.
Title: Re: Add user to group via lua
Post by: Caustic Soda-Senpai on April 09, 2015, 02:29:41 PM
RunConsoleCommand("ulx", "adduser", target_ply, group)
Title: Re: Add user to group via lua
Post by: Bytewave on April 09, 2015, 03:21:07 PM
RunConsoleCommand("ulx", "adduser", target_ply, group)
target_ply:Nick() *
Title: Re: Add user to group via lua
Post by: MrPresident on April 09, 2015, 05:52:07 PM
of, if you want to just bypass that entirely, you can go straight to UCL.

ULib.ucl.addUser( target_ply:SteamID(), nil, nil, group )
Title: Re: Add user to group via lua
Post by: JamminR on April 09, 2015, 08:09:25 PM
Yes indeed.
In theory, you wouldn't even need ULX installed. Only ULib.
See our ULib docs page, linked from the sticky post(s) at front of the Dev corner forum area.
Title: Re: Add user to group via lua
Post by: BigBrainAFK on April 10, 2015, 11:40:23 AM
Got it working now and i wanted to thank you guys for the quick help :D
Title: Re: Add user to group via lua
Post by: XxLMM13xX on April 11, 2015, 09:02:35 AM
In theory, you wouldn't even need ULX installed. Only ULib.

How is this??? If ULX is not installed how would the person be in a group???
Title: Re: Add user to group via lua
Post by: Decicus on April 11, 2015, 09:43:01 AM
How is this??? If ULX is not installed how would the person be in a group???
Because ULX uses ULib's group system, and you can add users to ULib using Lua and not just ULX.