ULX

Author Topic: Auto-add to usergroup based on kick/banned.  (Read 3857 times)

0 Members and 1 Guest are viewing this topic.

Offline jut

  • Newbie
  • *
  • Posts: 5
  • Karma: 1
Auto-add to usergroup based on kick/banned.
« on: January 03, 2021, 05:30:09 PM »
So this may be a feature in a mod somewhere, I did search but part of my problem is I am not sure how to properly search to see if it exist.
Basically what I want to know is, is it possible to implement a script that when a staff member kicks / bans a user, that user is then automatically added to a 'probationary' group for misbehaved players.

The reason why I was wondering if there was an automatic feature, is that not all players would have adduser access and this would allow it to be something that would ensure that problematic users are flagged in the ulx system (i.e those in the probationary group are already restricted as to what they CAN and CANNOT do)

Anyways I appreciate your help if you are able to tell me if such a thing does exist or if it is even possible.

P.s Happy new year everyone!

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Auto-add to usergroup based on kick/banned.
« Reply #1 on: January 07, 2021, 08:29:25 AM »
This is not a feature of ULX nor will something like this be added to ULX officially.
We do, however, have hooks in place that would allow you to write this function yourself.

http://ulyssesmod.net/docs/files/lua/ulib/shared/defines-lua.html#ULibPlayerBanned
http://ulyssesmod.net/docs/files/lua/ulib/shared/defines-lua.html#ULibPlayerKicked

The above two links are the hooks you would need to use to detect when a player is kicked or banned.

http://ulyssesmod.net/docs/files/lua/ulib/server/ucl-lua.html#ucl.addUser

The above link is the ULib UCL function you could call to set the player's group.


I hope this helps. :)

Offline jut

  • Newbie
  • *
  • Posts: 5
  • Karma: 1
Re: Auto-add to usergroup based on kick/banned.
« Reply #2 on: January 13, 2021, 06:16:33 AM »
Would this work?
Code: [Select]
function ULib.ban( ply )
    if ULib.addBan( ply:SteamID() ) then
      ucl.addUser( ply:SteamID(), "probationary")
    end
end
 

Thank you for your help!
« Last Edit: January 13, 2021, 04:29:26 PM by jut »

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Auto-add to usergroup based on kick/banned.
« Reply #3 on: January 27, 2021, 08:56:47 AM »
no, that's not how hooks are used. Please find some tutorials on gmod lua hooks and read up on them.
If you still need help, I would suggest joining our discord and asking for help there. Plenty of people there would would be willing to assist you and we check that more than these forums these days.