The player library is used to get the Lua objects that represent players in-game.
Player player.CreateNextBot( string botName )
Similar to the serverside command "bot", this function creates a new Player bot with the given name. This bot will not obey to the usual "bot_*" commands, and it's the same bot base used in TF2 and CS:S. The best way to control the behaviour of a Player bot right now is to use the GM:StartCommand hook and modify its input serverside. Despite this Player being fake, it has to be removed from the server by using Player:Kick and NOT Entity:Remove. Also keep in mind that these bots still u..
Gets all the current players in the server (not including connecting clients). This function returns bots as well as human players. See player.GetBots and player.GetHumans.This function returns a sequential table, meaning it should be looped with ipairs instead of pairs for efficiency reasons.
Player player.GetByAccountID( number accountID )
Gets the player with the specified AccountID. Internally this function iterates over all players in the server, meaning it can be quite expensive in a performance-critical context.
Player player.GetByID( number connectionID )
Gets the player with the specified connection ID. Connection ID can be retrieved via gameevent.Listen events. For a function that returns a player based on their Entity:EntIndex, see Entity. For a function that returns a player based on their Player:UserID, see Player.
Player player.GetBySteamID( string steamID )
Gets the player with the specified SteamID. Internally this function iterates over all players in the server, meaning it can be quite expensive in a performance-critical context.
Player player.GetBySteamID64( string steamID64 )
Gets the player with the specified SteamID64. Internally this function iterates over all players in the server, meaning it can be quite expensive in a performance-critical context.
Player player.GetByUniqueID( string uniqueID )
We advise against using this. It may be changed or removed in a future update. Use player.GetBySteamID64, player.GetBySteamID or player.GetByAccountID to get a player by a unique identifier instead. Gets the player with the specified uniqueID (not recommended way to identify players). It is highly recommended to use player.GetByAccountID, player.GetBySteamID or player.GetBySteamID64 instead as this function can have collisions ( be same for different people ) while SteamID is guaranteed to unique to each..
Gives you the player count. Similar to #player.GetAll() but with better performance since the player table doesn't have to be generated. If player.GetAll is already being called for iteration, then using the # operator on the table will be faster than calling this function since it is JITted.