Author Topic: ULibCommandCalled and args  (Read 1517 times)

0 Members and 1 Guest are viewing this topic.

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
ULibCommandCalled and args
« on: July 26, 2015, 07:39:48 AM »
Hey all.  Quick question.  I'm building a secondary logging system to highlight the use of ULX commands (I want this in the console logs and in a specific format, so the current logging options don't work for me).  I'm hooking into ULibCommandCalled.  I'm seeing tokenized target ids in the arguments (e.g., $3371261519) when someone uses the ULX gui to issue a target-based command.   Is there a simple way to translate these back into player ents?   I know I can use ULibPlayerTarget(s), but I'd rather only use one hook for target-based and non-target based commands.

Thanks!

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: ULibCommandCalled and args
« Reply #1 on: July 26, 2015, 01:40:59 PM »
In retrospect, its probably better for me to hook ULibPlayerTarget(s) as well --- doesn't make sense for me to try and out-think ULib, and the cost of hooking all 3 and taking what I want from each is pretty small.

Thx

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: ULibCommandCalled and args
« Reply #2 on: July 29, 2015, 08:59:12 AM »
To answer your original question (if you still need it), you can convert the targeting string back to player ent(s) by using ULib's getUser:
http://ulyssesmod.net/docs/files/lua/ulib/shared/player-lua.html#getUser

That should easily convert whatever is specified for the playerArg(s) into a nice table of player entities. I'm not quite sure if that takes into account whether or not the calling player CAN target those players, though, so your ULibPlayerTarget idea still might be better.  :)
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6