CityRP Documentation Repository

CPPI

Functions

SharedCPPI:GetInterfaceVersion() → numberSource ☍

CPPI: version of the CPPI standard this interface implements. Required. 2.0 is a CityRP-local extension of the standard - there's no published 2.0 spec, this just means "CPPI 1.3 plus our own additions" (see OwnerSID on Entity, and any other CityRP-specific behaviour documented alongside it).

Returns

  1. number
SharedCPPI:GetName() → stringSource ☍

CPPI: name of the active prop protection. Required.

Returns

  1. string
SharedCPPI:GetNameFromSID(sid) → string|number|nilSource ☍

CPPI: resolves a player's name from their SteamID64/CommunityID, checking online players first, then (server-only) an in-memory cache warmed by online players, then (server-only, rate-limited) a DB lookup. This replaces GetNameFromUID - Player: UniqueID() is deprecated by GMod and not guaranteed unique, so this codebase keys everything by SteamID64/CommunityID instead. Not part of the CPPI 1.3 standard (which specifies a UID-based GetNameFromUID); a CPPI 2.0 (CityRP-local) addition.

Warning

On the client, this only works for online players.

Parameters

  • sidstringA SteamID64/CommunityID - NOT a classic SteamID32 (STEAM_0:...).

Returns

  1. string|number|nilnil if no match, CPPI_DEFER if a lookup is pending/unsupported.
SharedCPPI:GetVersion() → stringSource ☍

CPPI: version of the active prop protection. Required.

Returns

  1. string
ServerCPPI.LookupNameFromSID(sid) → string|number|nilSource ☍

Resolves an offline player's name from CPPI.NameCache, or (rate-limited) issues a DB lookup and returns CPPI_DEFER while it's pending.

Parameters

  • sidstringSteamID64/CommunityID.

Returns

  1. string|number|nilnil if sid isn't well-formed, CPPI_DEFER if pending.
SharedGAMEMODE:CPPIAssignOwnership(ply, ent)Source ☍

CPPI: called when ply assumes ownership of ent. Recommended, not required.

Parameters

SharedGAMEMODE:CPPIFriendsChanged(ply, friends)Source ☍

CPPI: called when ply's friends list changes. Recommended, not required.

Parameters

  • plyPlayer
  • friendstableThe player's new friends list.

Tables

SharedCPPISource ☍

CPPI (Common Prop Protection Interface), implemented by Simple Prop Protection. See: https ://ulyssesmod.net/archive/CPPI_v1-3.pdf

SharedCPPI.NameCacheSource ☍

In-memory cache backing CPPI.LookupNameFromSID, keyed by SteamID64/CommunityID. Each entry is {name = string|nil, lastHit = number, lastQuery = number|nil}, where name is nil until a DB lookup resolves it, and lastQuery rate-limits re-querying the same SID.

SharedCPPI.NameCacheSettingsSource ☍

Tuning for CPPI.NameCache's query rate-limit and cleanup timer.

Fields

SharedCPPI.LoggerSource ☍

A namespaced, level-filterable logger. Obtain instances via cityrp.logging.GetLogger rather than constructing directly.

SharedCPPI_DEFERSource ☍
SharedCPPI_NOTIMPLEMENTEDSource ☍