ULX

Author Topic: Action hooks  (Read 2853 times)

0 Members and 1 Guest are viewing this topic.

Offline Fleamonji

  • Newbie
  • *
  • Posts: 45
  • Karma: 0
Action hooks
« on: January 24, 2011, 04:11:12 PM »
Hooks when someone gets kicked/banned would be nice.  I'm trying to make ULX store every kick into a MySQL database, but it's pretty much impossible without a hook

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Action hooks
« Reply #1 on: January 24, 2011, 05:03:36 PM »
Could easily write your own ULX ban/kick monitoring hook.
http://ulyssesmod.net/docs/files/lua/ulib/shared/defines-lua.html#ULibPlayerTarget

As for when rcon/server did it without ULX, not sure what the hook might be.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Action hooks
« Reply #2 on: January 24, 2011, 11:02:37 PM »
http://ulyssesmod.net/docs/files/lua/ulib/shared/defines-lua.html#ULibPostTranslatedCommand

if ( commandName == "ulx ban" or commandName == "ulx banid" ...

Et cetera..
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Action hooks
« Reply #3 on: January 25, 2011, 02:23:08 PM »
Yes, what Sticky said for 'after' the command is performed would, logically, be even better.
However, that stilll doesn't account for non ULX commands 'kick, kickid, ban, banid, etc'.
Those are server functions, and I'm not sure Garry ever made lua hooks for them.
I poked around the Gmod wiki. Seems Gamemode.PlayerDisconnected itself only kicks off when a 'normal' disconnect occurs (quit, etc)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming