TeamUlysses / ulib

ULib: A Lua library for more rapid development on Garry's Mod servers
http://ulyssesmod.net
Other
105 stars 55 forks source link

The ULibUserRemoved Event Passes the Wrong ID to the Callback #46

Closed Bash4195 closed 6 years ago

Bash4195 commented 6 years ago

This issue just needs the documentation updated to say that it returns a ulib id, or update the functionality to return the user steam id. It only took a bit of digging to find out I needed to use ULib.getPlyByID(id):SteamID64() to get the Steam ID I needed, but to save others the trouble, I wanted to point this out.

Steps to reproduce

  1. Run a function on the hook ULibUserAccessChange and print out the ID as such:
    hook.Add('ULibUserRemoved', 'MistyMeadowsUserRemoved', function(id, userInfo)
    print(id)
    end)

Expected behavior

I was expecting it to pass the user steamid to the callback since that's what the documentation says it does. http://ulyssesmod.net/docs/files/lua/ulib/shared/defines-lua.html#ULibUserRemoved

Actual behavior

It passes a ulib specific ID.

Error(s) in server console, if any

N/A

Error(s) in player's console, if any

N/A

Version

ULib v2.63w ULX v3.73w

Nayruden commented 6 years ago

There's no "ULib specific ID". It's possible that it could pass back the IP or UID (UID is determined by the engine) of the player in the hook, but that's only if you're calling the API directly to add/remove users since ULX/XGUI dropped support for those a long time ago.

You should be getting a standard / 32-bit SteamID in the hook. If you want to convert it to a 64-bit SteamID, it's best to pass it to SteamIDTo64

Bash4195 commented 6 years ago

Ah okay, I just checked and it is the UID you mentioned. Still, that's the ID I'm getting from the hook rather than a Steam ID. I'm on the latest version of ULX and ULib, not accessing any internal functions directly, just using that hook in the post. Any other ideas? I'm running this server-side if that helps.

I'm at least able to use the ULib.getPlyByID function to get the player object with the UID passed and from there get the Steam ID I want, so there is a workaround to this.