-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Miscellaneous E2 player additions #2718
Conversation
Add e:userID() Add player(n) Add teamMembers(n) and teamMemberCount(n) (deprecate teamPlayers) Minor cleanup
Clean entity:inVehicle()
Don't leave commented code; just delete it |
Think of all the keystrokes that guy in 15 years will save. |
@@ -85,7 +75,25 @@ e2function string entity:steamID64() | |||
if not IsValid(this) then return self:throw("Invalid entity!", "") end | |||
if not this:IsPlayer() then return self:throw("Expected a Player but got an Entity!", "") end | |||
|
|||
return this:SteamID64() or "" | |||
return this:SteamID64() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vaguely remember this returning nil if the the player is a bot. Might need the or ""
. Could be wrong though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of the changes look fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest update said it now always returns something valid.
Made Player:SteamID64 and Player:AccountID never return no value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no value
is not the same as nil
, although it looks like they did also change the nil case. I think the only case where this happened was when a player signed in on a -multirun client.
Additions:
number entity:accountID()
- returns the player's account ID.number entity:userID()
- returns the player's user ID. This is different from entity index.entity player(index)
- returns a player entity from the user ID.array teamMembers(index)
- returns an array with the members of a team.number teamMemberCount(index)
- returns the number of players on a team.Changes:
number teamPlayers(index)
(misleading, should be replaced byteamMembers
)Removals:
Player.LocalEyeAngles()
existingTest code
Fixes #2660