PlayerClient
A player's client instance.
Class Instance Methods
PlayerClient:GetNetPlayer(): NetPlayer
Returns the NetPlayer associated with this PlayerClient.
Returns: NetPlayer - The NetPlayer instance associated with this client
Example:
local netPlayer = client:GetNetPlayer()
print("Player name: " .. netPlayer:GetNick())
PlayerClient:GetNick(): string
Returns the player's nickname as a string.
Returns: string - The player's nickname
Example:
local nickname = client:GetNick()
print("Player nickname: " .. nickname)
PlayerClient:GetSteamId(): string
Returns the player's Steam ID as a string.
Returns: string - The player's Steam ID
Example:
local steamId = client:GetSteamId()
print("Player Steam ID: " .. steamId)
PlayerClient:GetNetId(): number
Returns the player's network ID as a number.
Returns: number - The player's network ID
Example:
local netId = client:GetNetId()
print("Player network ID: " .. netId)
PlayerClient:GetPing(): number
Returns the player's ping as a number.
Returns: number - The player's ping in milliseconds
Example:
local ping = client:GetPing()
print("Player ping: " .. ping .. "ms")
PlayerClient:SetAclLevel(level: AclLevel): void
Sets the access control list level for the player.
Parameters:
level: AclLevel- The access control level to set for the player
Example:
-- Set player as an administrator
playerClient:SetAclLevel(AclLevel.Admin)
-- Set player as a moderator
playerClient:SetAclLevel(AclLevel.Moderator)
PlayerClient:GetAclLevel(): AclLevel
Gets the access control list level for the player.
Returns: AclLevel - The current access control level of the player
Example:
local aclLevel = playerClient:GetAclLevel()
if aclLevel == AclLevel.Admin then
print("Player is an administrator")
end
PlayerClient:Kick(reason: string): void
Kicks the player from the server with the given reason.
PlayerClient:Ban(reason: string): void
Bans the player from the server with the given reason. They will be unable to join the server until their ban is removed. Bans are stored in bans.txt in the server's root directory.
A ban can be removed by:
- Editing
bans.txt, removing their Steam ID, and restarting the serverbans.txtis a text file containing the Steam IDs of banned players, one per line
- Typing
unban <steam_id>in the server console