Shared library

Even more library stuff that executes on both server and client.

Summary
Shared libraryEven more library stuff that executes on both server and client.
Variables
playerTableStores player names indexed by uid.
Functions
nameFromIDGets the last known player name for a user uid.
nameToIDDO NOT CALL DIRECTLY, UPS HANDLES THIS FUNCTION Sets the name for use with nameFromID.
ENTITY: UPSGetOwnerGets the unique id of the owner of this prop.
ENTITY: UPSGetOwnerEntGets the player entity of the owner of this prop or nil if it has no owner or the owner is disconnected.
ENTITY: UPSSetOwnerEntSets the current entity owner to the player specified.
ENTITY: UPSClearOwnerClears the owner of this entity and puts it “up for grabs”.
GAMEMODE: UPSAssignOwnershipThis hook allows you to override an ownership change or simply catalog it.
deleteAllThis function removes all of a player’s worldly possessions.

Variables

playerTable

playerTable

Stores player names indexed by uid.

Functions

nameFromID

function nameFromID(uid)

Gets the last known player name for a user uid.  The unique id is based off GMod’s ply:UniqueID().  This is similar to GMod’s player.GetByUniqueID() except it keeps the names even after dicsconnect.

Parameters

uidA number or string representing the user’s uid.  This value gets automatically converted to a number.

Returns

The string of the player’s last known name if found, otherwise nil.

nameToID

function nameToID(uid,
name)

DO NOT CALL DIRECTLY, UPS HANDLES THIS FUNCTION Sets the name for use with nameFromID.

Parameters

uidA number or string representing the user’s uid.  This value gets automatically converted to a number.
nameThe name to assign to the id.

ENTITY: UPSGetOwner

Gets the unique id of the owner of this prop.  Can return one of the OWNERID_* variables (see definitions and explanations in defines)

Returns

The short id.

ENTITY: UPSGetOwnerEnt

Gets the player entity of the owner of this prop or nil if it has no owner or the owner is disconnected.

Returns

The short id.

ENTITY: UPSSetOwnerEnt

Sets the current entity owner to the player specified.

Parameters

plyThe valid player object to own this entity.

ENTITY: UPSClearOwner

Clears the owner of this entity and puts it “up for grabs”.

GAMEMODE: UPSAssignOwnership

function GAMEMODE:UPSAssignOwnership(ply,
ent)

This hook allows you to override an ownership change or simply catalog it.

deleteAll

function deleteAll(uid,
isLeaving)

This function removes all of a player’s worldly possessions.  Handle with care!  Note that this function is shared but it automatically invokes the client side part when called from the server.

Parameters

uidThe uid of the owner who is about to lose everything they own.
isLeavingA boolean stating whether or not the player is disconnecting.  If true, this function clears their data out completely.
playerTable
Stores player names indexed by uid.
function nameFromID(uid)
Gets the last known player name for a user uid.
function nameToID(uid,
name)
DO NOT CALL DIRECTLY, UPS HANDLES THIS FUNCTION Sets the name for use with nameFromID.
function GAMEMODE:UPSAssignOwnership(ply,
ent)
This hook allows you to override an ownership change or simply catalog it.
function deleteAll(uid,
isLeaving)
This function removes all of a player’s worldly possessions.
Close