Has useful player-related functions.
Player | Has useful player-related functions. |
Functions | |
getPicker | Gets the player directly in front of the specified player |
getPlyByID | Finds a user identified by the given ID. |
getUniqueIDForPly | Finds a unique ID for a player, suitable for use in getUsers or getUser to uniquely identify the given player. |
getUsers | Finds users matching an identifier. |
getUser | Finds a user matching an identifier. |
function ULib.getPicker( ply, radius )
Gets the player directly in front of the specified player
ply | The player to look for another player in front of. |
radius | (Optional, defaults to 30) How narrow to make our checks for players in front of us. |
The player most directly in front of us if one exists with the given constraints, otherwise nil.
v2.40 | Initial. |
Finds a unique ID for a player, suitable for use in getUsers or getUser to uniquely identify the given player.
ply | The player we want an ID for |
The id for the player or nil if none are unique.
v2.50 | Initial. |
v2.51 | Added exception for single player since it’s handled differently on client and server. |
function ULib.getUsers( target, enable_keywords, ply )
Finds users matching an identifier.
target | A string of what you’d like to target. Accepts a comma separated list. |
enable_keywords | (Optional, defaults to false) If true, various keywords will be enabled: “*” for all players, “^” for self, “@” for picker (person in front of you), “#<group>” for those inside a specific group, “%<group>” for users inside a group (counting inheritance), “$<id>” for users matching a particular ID, and “@<team>” for users inside a given team Any of these can be negated with “!” before it. IE, “!^” targets everyone but yourself. |
ply | (Optional) Player needing getUsers, this is necessary for some of the keywords. |
A table of players (false and message if none found).
v2.40 | Rewrite, added more keywords, removed immunity. |
v2.50 | Added “#” and ‘$’ keywords, removed special exception for “%user” (replaced by “#user”). |
v2.60 | Returns false if target is an empty string. |
v2.70 | Added “@<team>” keyword extension. |
function ULib.getUser( target, enable_keywords, ply )
Finds a user matching an identifier.
target | A string of the user you’d like to target. IE, a partial player name. |
enable_keywords | (Optional, defaults to false) If true, the keywords “^” for self, “@” for picker (person in front of you), and “$<id>” will be activated. |
ply | (Optional) Player needing getUsers, this is necessary to use keywords. |
The resulting player target, false and message if no user found.
v2.40 | Rewrite, added keywords, removed immunity. |
v2.50 | Added “$” keyword. |
v2.60 | Returns false if target is an empty string. |
Gets the player directly in front of the specified player
function ULib.getPicker( ply, radius )
Finds a user identified by the given ID.
function ULib.getPlyByID( id )
Finds users matching an identifier.
function ULib.getUsers( target, enable_keywords, ply )
Finds a user matching an identifier.
function ULib.getUser( target, enable_keywords, ply )