Ulysses
General => Developers Corner => Topic started by: iViscosity on May 20, 2017, 04:43:43 PM
-
So as I'm sure many of you know, in TTT you can get Karma banned or kicked if your Karma falls below a certain level (set by the server). Now, in this ban-syncing addon I'm writing, I need to check if the player was Karma banned because one of my config settings allows to disable syncing bans if the player was Karma banned. After looking in the TTT Hooks (http://ttt.badking.net/guides/hooks) page, I found "TTTKarmaLow" which is
Called when a player is about to be kicked/banned because their karma has gone below the the autokick/ban level specified in the server's configuration
Now, the only thing I can do with this hook is make it return false if I want to stop the kick/ban from happening, but I'm not sure how to check if this hook WAS called or not. I'm not super familiar with hooks, I've only used (http://wiki.garrysmod.com/favicon.ico) hook.Add (http://wiki.garrysmod.com/page/hook/Add) to do certain things with hooks, but nothing like this. Is there any way to check if a hook has been called or a way to see if they have been karma banned?
EDIT:
Ok, after legit reading a few lines down, I found how it assigns ply.karma_kicked = true (https://github.com/garrynewman/garrysmod/blob/222de8967fdecb707a5d4463576c0b1561fb46e0/garrysmod/gamemodes/terrortown/gamemode/karma.lua#L346), so I can check if this variable is true and abort if the config says to.
-
You could probably set a variable on the Player object passed to TTTKarmaLow, and read that variable in your ban hook. If it's true and your config option is set, just don't record the ban.
-
Huh, never actually thought of that. Thanks