Banning to group banned.

Let’s say I ban someone from my server. And every time I ban them I move them to group “banned” So when their ban is lifted we will know who is in group banned. But the whole point of this post is to ask if there’s a code out there that will add people to group “banned” When banned from my server.

To shorted it down, (Someone) Banned for 3 days. <- I want them moved into group “Banned” When banned.
Instead I have to open the !menu and move them manually. So i’m looking for a code to do it for me so the Trialstaff - Superadmins can put them there.

Before the ban function is ran, set their usergroup to banned.

Alright.

[editline]12th April 2015[/editline]

Unsure how to, But i’ll figure it out later today. Thanks for the help.

Which admin mod are you using?

ULX

_p:SetUserGroup( “banned” );
ulx uses it: http://wiki.garrysmod.com/page/Player/SetUserGroup

So I add this to bans.lua?

https://github.com/Nayruden/Ulysses/blob/master/ulx/lua/ulx/modules/sh/util.lua#L64
Make some space and write


target_ply:SetUserGroup("banned")

Would it not be better to use the ULib function?
https://github.com/Nayruden/Ulysses/blob/f27b8292e10579f55ab2d81e6b1f44d119fb33d7/ulib/lua/ulib/server/player.lua#L149

I’ll try this code out on line 65. Thank you and i’ll tell you if it worked or not.

[editline]12th April 2015[/editline]

The command target_ply:SetUserGroup(“banned”) didn’t work.

I don’t think it matters as long as it works.


What was the error?

There wasn’t I banned some one and it just banned them and didn’t move them. I restart the server to try it again. But It said he was in group Banned. So I banned him again and lifted the ban to see he’s still in group reg. So basically it didn’t move him till the server restarted.

That functions calls ULib.kickban here: https://github.com/Nayruden/Ulysses/blob/master/ulx/lua/ulx/modules/sh/util.lua#L66

So if an addon calls ulx ban or ULib.kickban then the method I proposed would work, if it only called ULib.kickban then your method isn’t going to work.

So keep it as target_ply:SetUserGroup(“banned”) in the ULX?

Try add this instead



RunConsoleCommand( "ulx", "adduser",  target_ply:Nick(), "banned" )


Perhaps ULX does some more behind the scenes rather than set the user group. I’m not sure.

Worked fantastically, Thank you for your help.

That will probably mess it up if the target got some weird character in their name.