Ulysses
General => Developers Corner => Topic started by: Buzzkill 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!
-
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
-
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 (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. :)