Player

Holds some helpful player functions.

Summary
PlayerHolds some helpful player functions.
Tables
slapSoundsThese are the sounds used for slaps.
Functions
slapSlaps an entity, can be a user or any entity.
kickKicks a user.
banBans a user.
kickbanKicks and bans a user.
addBanHelper function to store additional data about bans.
unbanUnbans the given steamid.
invisibleMakes a user invisible
refreshBansRefreshes the ULib bans.
getSpawnInfoGrabs and returns player information that can be used to respawn player with same health/armor as before the spawn.
spawnEnhanced spawn player.

Tables

slapSounds

These are the sounds used for slaps.

Functions

slap

function ULib.slap(ent,
damage,
power,
nosound)

Slaps an entity, can be a user or any entity.

Parameters

entThe target ent.
damage(Optional, defaults to 0) The amount of damage to inflict on the entity.
power(Optional, defaults to 30) The power of the slap.
nosound(Optional, defaults to false) If true, no sound will be played.

kick

function ULib.kick(ply,
reason)

Kicks a user.

Parameters

plyThe player to kick.
reason(Optional) The reason to give for kicking.

ban

function ULib.ban(ply,
time,
reason,
admin)

Bans a user.

Parameters

plyThe player to ban.
time(Optional) The time in minutes to ban the person for, leave nil or 0 for permaban.
reason(Optional) The reason for banning
admin(Optional) Admin player enacting ban

Revisions

v2.10Added support for custom ban list

kickban

function ULib.kickban(ply,
time,
reason,
admin)

Kicks and bans a user.

Parameters

plyThe player to ban.
time(Optional) The time in minutes to ban the person for, leave nil or 0 for permaban.
reason(Optional) The reason for banning
admin(Optional) Admin player enacting ban

Revisions

v2.10Added support for custom ban list

addBan

function ULib.addBan(steamid,
time,
reason,
name,
admin)

Helper function to store additional data about bans.

Parameters

steamidBanned player’s steamid
timeLength of ban
reason(Optional) Reason for banning
name(Optional) Name of player banned
admin(Optional) Admin player enacting the ban

Revisions

2.10Initial
2.40If the steamid is connected, kicks them with the reason given

unban

function ULib.unban(steamid)

Unbans the given steamid.

Parameters

steamidThe steamid to unban.

Revisions

v2.10Initial

invisible

function ULib.invisible(ply,
bool,
visibility)

Makes a user invisible

Parameters

plyThe player to affect.
boolWhether they’re invisible or not
visibility(Optional, defaults to 0) A number from 0 to 255 for their visibility.

Revisions

v2.40Removes shadow when invisible

refreshBans

function ULib.refreshBans()

Refreshes the ULib bans.

getSpawnInfo

function ULib.getSpawnInfo(player)

Grabs and returns player information that can be used to respawn player with same health/armor as before the spawn.

Parameters

plyThe player to grab information for.

Returns

Updates player object to store health and armor.  Has no effect unless ULib.Spawn is used later.

spawn

function ULib.spawn(player,
bool)

Enhanced spawn player.  Can spawn player and return health/armor to status before the spawn.  (Only IF ULib.getSpawnInfo was used previously.)  Clears previously set values that were stored from ULib.getSpawnInfo.

Parameters

plyThe player to grab information for.
boolIf true, spawn will set player information to values stored using ULib.SpawnInfo

Returns

Spawns player.  Sets health/armor to stored defaults if ULib.getSpawnInfo was used previously.  Clears SpawnInfo table afterwards.

function ULib.slap(ent,
damage,
power,
nosound)
Slaps an entity, can be a user or any entity.
function ULib.kick(ply,
reason)
Kicks a user.
function ULib.ban(ply,
time,
reason,
admin)
Bans a user.
function ULib.kickban(ply,
time,
reason,
admin)
Kicks and bans a user.
function ULib.addBan(steamid,
time,
reason,
name,
admin)
Helper function to store additional data about bans.
function ULib.unban(steamid)
Unbans the given steamid.
function ULib.invisible(ply,
bool,
visibility)
Makes a user invisible
function ULib.refreshBans()
Refreshes the ULib bans.
function ULib.getSpawnInfo(player)
Grabs and returns player information that can be used to respawn player with same health/armor as before the spawn.
function ULib.spawn(player,
bool)
Enhanced spawn player.
Close