CityRP Documentation Repository

cityrp.favorites

Client-side item favourites, shared by every item browser (inventory, market). Favourites are stored per-client in PData, keyed by item uniqueID, so a star set in one panel shows up in the other.

Functions

Clientcityrp.favorites.Get() → table<string, boolean>Source ☍

Get the favourites set, loading it from PData on first use. The table is the live one -- read from it, but go through Set/Toggle to change it.

Returns

  1. table<string, boolean>Keyed by item uniqueID.
Clientcityrp.favorites.IsFavorite(uniqueID) → booleanSource ☍

Check whether an item is favourited.

Parameters

  • uniqueIDstring?The item uniqueID to check.

Returns

  1. boolean
Clientcityrp.favorites.Set(uniqueID, state) → booleanSource ☍

Set an item's favourite state and persist it. Fires the cityrp_FavoritesChanged hook when the state actually changed, so open panels can refresh a favourites-filtered list they are already showing.

Parameters

  • uniqueIDstringThe item uniqueID.
  • statebooleanWhether the item should be favourited.

Returns

  1. booleanIf the stored state changed.
Clientcityrp.favorites.Toggle(uniqueID) → booleanSource ☍

Flip an item's favourite state.

Parameters

  • uniqueIDstringThe item uniqueID.

Returns

  1. booleanThe state the item is now in.

Fields

Clientcityrp.favoritesSource ☍