ULX

Author Topic: Check for karma ban  (Read 1384 times)

0 Members and 1 Guest are viewing this topic.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Check for karma ban
« 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 page, I found "TTTKarmaLow" which is
Quote
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 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, so I can check if this variable is true and abort if the config says to.
« Last Edit: May 20, 2017, 04:47:06 PM by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: Check for karma ban
« Reply #1 on: May 21, 2017, 11:12:54 AM »
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.
bw81@ulysses-forums ~ % whoami
Homepage

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Check for karma ban
« Reply #2 on: May 21, 2017, 11:23:48 AM »
Huh, never actually thought of that. Thanks
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.