Ulysses
General => Developers Corner => Topic started by: BLEEP_BLOOP on July 31, 2016, 12:02:10 AM
-
Is there a hook called when someone gets banned or kicked with ULX. If not, is there some way similar that would accomplish this? Any help is appreciated.
-
Looking at the Github for ULX (https://github.com/TeamUlysses/ulib/blob/81044e2a65790d264a45e9bbc54cbe1cb615b64c/lua/ulib/server/player.lua#L158) it looks like it just uses the Player Kick (http://wiki.garrysmod.com/page/Player/Kick) function on the Garry's Mod Wiki (http://wiki.garrysmod.com/).
-
Yes, I know that, but is a hook called when it kicks/bans the player? If not, what would be the best way of checking for a kick/ban?
-
Yes, I know that, but is a hook called when it kicks/bans the player? If not, what would be the best way of checking for a kick/ban?
It just uses a Gmod function, I don't think it uses a hook. You could check the server logs.
-
I'm looking for some way to check if a player has been kicked or banned. So what do you think is the best way to check that through GLua?
-
The best way I think would be via server logs if you have access to those.
-
I wanted to check for a kick/ban through Lua not to actually look at server logs.
-
You can use the ULibCommandCalled (http://ulyssesmod.net/docs/files/lua/ulib/shared/defines-lua.html#ULibCommandCalled) hook to detect when a player is banned. I'm not sure if this will be 100% reliable as it may still be called even if the commands arguments are invalid (i.e. the player will not be banned), but it's your best bet other than parsing the ULX logs.
As for the logs, it is possible to find bans in them via the (http://wiki.garrysmod.com/favicon.ico) file (http://wiki.garrysmod.com/page/file) library. It's just a bit of work figuring out which pattern(s) you need in order to get the bans.
-
There is also ULibPostTranslatedCommand (http://ulyssesmod.net/docs/files/lua/ulib/shared/defines-lua.html#ULibPostTranslatedCommand) , which might be better as it's only hooks when the ulx commands are properly completed.
The challenge with using ULib library to monitor for kick or ban using commandcalled or posttranslatedcommand is that an admin or above could use standard server kick or ban commands instead of the ULX version. It's possible not many admins might know how to use those two commands, but I used to use them from console when in a hurry.
Ulib would never see those.