CityRP Documentation Repository

core.plugins.lite_character.sv_init

Lite Character System -- server-side persistence, activation channel, and lockout. Slot data is never cached on the player for the session -- it's accessed rarely enough (open editor, save, activate) that every read/write goes straight to the DB instead of keeping a stale in-memory copy around.

Functions

Servercityrp.litecharacter.BeginActivation(ply, slot)Source ☍

Begins the stand-still activation channel for a slot.

Parameters

Servercityrp.litecharacter.CancelActivation(ply, reason)Source ☍

Cancels a running activation channel, if any.

Parameters

  • plyPlayer
  • reasonstring|nilPlayer-facing notify message. Omit for a silent cancel (e.g. disconnect).
Servercityrp.litecharacter.CompleteActivation(ply, slot, record) → boolean|nilSource ☍

@param record — The already-fetched record for this activation.

Parameters

  • plyPlayer
  • slotnumber
  • recordtableThe already-fetched record for this activation.

Returns

  1. boolean|nil
Servercityrp.litecharacter.DeleteSlot(ply, slot, callback)Source ☍

Deletes a player's saved slot entirely. Distinct from saving a slot withevery field blank.

Parameters

  • plyPlayer
  • slotnumber
  • callbackfun(ok: boolean, reason: string|nil)
Servercityrp.litecharacter.IsLockedOut(ply) → booleanSource ☍

Parameters

Returns

  1. boolean
Servercityrp.litecharacter.PushLockoutState(ply)Source ☍

Pushes the player's current lockout countdown.

Parameters

Servercityrp.litecharacter.ResetLockout(ply)Source ☍

Clears the lockout early (death / team change). No-op if not currently locked out.

Parameters

Servercityrp.litecharacter.SaveSlot(ply, slot, data, callback)Source ☍

Validates and persists one slot from a client-submitted payload. Never trusts the client

Parameters

Servercityrp.litecharacter.SendSummary(ply)Source ☍

Pushes the per-slot populated/name summary the notches render from.

Parameters

Servercityrp.litecharacter.SetLockout(ply, until_)Source ☍

@param until_ — CurTime() timestamp the lockout ends at (0 to clear).

Parameters

  • plyPlayer
  • until_numberCurTime() timestamp the lockout ends at (0 to clear).
Servercityrp.litecharacter.ValidateActivation(ply, record) → boolean, string|nil, string|nil, string|nil, string|nil, boolean|nilSource ☍

Re-validates every saved selection in a record against the player's current inventory/authorization

Parameters

Returns

  1. 1boolean
  2. 2string|nilPlayer-facing rejection reason, only set when ok is false.
  3. 3string|nilOnly set when ok is true.
  4. 4string|nilResolved playermodel path. Only set when ok is true.
  5. 5string|nilNon-fatal notice for an otherwise-successful activation (Team Character job-mismatch, or a modelItem requirement no longer met).
  6. 6boolean|nilTrue when record.modelItem exists but was soft-failed (requirements no longer met) -- tells CompleteActivation's Phase 2 to leave the model alone instead of applying record.modelItem unconditionally.
Servercityrp.litecharacter.ValidateOwnedAccessory(ply, uniqueID, expectedType) → boolean, string|tableSource ☍

@param expectedType — CityAccessories .Type this dropdown slot is fixed to.

Parameters

  • plyPlayer
  • uniqueIDstring
  • expectedTypestringCityAccessories .Type this dropdown slot is fixed to.

Returns

  1. 1boolean
  2. 2string|table
Servercityrp.litecharacter.ValidateOwnedBodygroupAccessory(ply, uniqueID, modelPath) → boolean, string|table, booleanSource ☍

@param modelPath — The playermodel path this accessory must be compatible with.

@return ok

@return itemOrReason

@return modelMismatch — True only when the sole problem is item not fitting modelPath -- distinct from not owned/excluded/unregistered, which is a real "missing item". Lets callers (e.g. ValidateActivation) treat a mismatch as skip-worthy instead of a hard failure.

Parameters

  • plyPlayer
  • uniqueIDstring
  • modelPathstring|nilThe playermodel path this accessory must be compatible with.

Returns

  1. 1boolean
  2. 2string|table
  3. 3booleanTrue only when the sole problem is item not fitting modelPath -- distinct from not owned/excluded/unregistered, which is a real "missing item". Lets callers (e.g. ValidateActivation) treat a mismatch as skip-worthy instead of a hard failure.
Servercityrp.litecharacter.ValidateOwnedItem(ply, uniqueID, requiredCategoryParent) → boolean, string|tableSource ☍

Validates that a player owns a usable, non-excluded item of the given parent category.

Parameters

  • plyPlayer
  • uniqueIDstring
  • requiredCategoryParentstring|nilPass nil to skip the category check.

Returns

  1. 1boolean
  2. 2string|tableThe item table on success, a player-facing reason string on failure.