CityRP Documentation Repository

cityrp.remote

Remote Commands Library.

Functions

Servercityrp.inventory.itemExists(ply, item, quantity) → boolean?Source ☍

Check if a player has an item in their inventory, optionally requiring a minimum quantity.

Parameters

  • plyPlayerThe player to check.
  • itemstringThe item ID to check for.
  • quantitynumber?The minimum quantity required.

Returns

  1. boolean?Whether the player has the item, in the required quantity if given.
Servercityrp.remote.check()Source ☍

Call the database for any unprocessed remote commands, and run any handlers attached to them.

Internal

This function is internal. Whilst you can call it, you probably shouldn't.

Called on a repeating timer; should not be called directly.

Servercityrp.remote.checkRow(row) → booleanSource ☍

Check if there is a handler function for a given row, and if so, call it.

Parameters

  • rowtableThe row to check.

Returns

  1. booleanWhether a handler was found and called.
Servercityrp.remote.done(id)Source ☍

Mark a row as done by passing its ID.

Parameters

  • idstring|numberThe ID of the row to mark as complete.
Servercityrp.remote.doPRAlert(ply, id) → booleanSource ☍

Small function to notify a player of a player report.

Parameters

  • plyPlayerThe player to alert.
  • idstring|numberThe thread ID of the thread with the report.

Returns

  1. booleanWhether the player was notified.
Servercityrp.remote.exploit(id)Source ☍

Flag a row for requiring an exploit check.

Parameters

  • idstring|numberThe ID of the row to mark as exploited.
Servercityrp.remote.membership(ply, qty) → booleanSource ☍

Add a set of membership to the player.

Parameters

  • plyPlayerThe player to add membership for.
  • qtystring|numberThe number of membership units to apply.

Returns

  1. booleanWhether the player was given membership.
Servercityrp.remote.moneypack(ply, qty) → booleanSource ☍

Add moneypacks to the player.

Parameters

  • plyPlayerThe player to add packs for.
  • qtystring|numberThe number of moneypacks to add.

Returns

  1. booleanWhether the player was given their packs.
Servercityrp.remote.premiumToken(ply, qty, purchaser64) → booleanSource ☍

Give Premium Token items from the website (ptoken). Stamps hidden purchaser meta. Returns false (row stays pending) when the player cannot receive them yet.

Parameters

  • plyPlayerThe player to give tokens to.
  • qtystring|numberThe number of tokens to give.
  • purchaser64string?Original website purchaser Steam64.

Returns

  1. booleanWhether the player was given their tokens.
Servercityrp.remote.propcleanup(issuer, target) → booleanSource ☍

Run a prop cleanup, either globally or for a specific player.

Parameters

  • issuerstringThe SteamID of the user who issued the cleanup.
  • targetstring|Entity|nilA player entity to clean up, or "global" to clean up for everyone.

Returns

  1. booleanWhether the cleanup ran.
Servercityrp.remote.registerFunction(mType, func)Source ☍

Register a function to be called for a specific type of remote message.

Parameters

  • mTypestringThe type of remote messages to watch for.
  • funcfun(row: table, done: fun())The function to be called if found. Row is the row data table; calling done() marks the row as processed.
Servercityrp.remote.stalled(id)Source ☍

Flag a row as stalled (inventory manager).

Parameters

  • idstring|numberID of the row to mark.
Servercityrp.remote.status(id, status)Source ☍

Set the status of a row.

Parameters

  • idstring|numberThe ID of the row.
  • statusstring|numberThe new status to set.
Servercityrp.remote.stockDone(id)Source ☍

Flag a row as completed for the stock exchange.

Parameters

  • idstring|numberThe ID of the row to mark as complete.

Tables

Servercityrp.clans.lastreloadSource ☍
Servercityrp.remoteSource ☍

Table for data storage and global access.

Servercityrp.remote.functionsSource ☍
Servercityrp.remote.noSaveSource ☍

List of servers which don't save data (so don't do membership, money or inventory shit on them).

Servercityrp.remote.rulesSharedSeenSource ☍

Ids of shared reloadrules rows this server has already acted on, so its later polls do not reload again.

Fields

Servercityrp.remote.lastRulesReloadSource ☍

When the last reloadrules reload started, in os.time seconds.

Servercityrp.remote.pendingRulesRowSource ☍

The id of the reloadrules row whose load has not finished, or nil. That row is unmarked until its load lands, so its own retry on the next poll starts a fresh load even inside the cooldown, while other rows in the cooldown are marked done because the pending load will deliver for them.

Servercityrp.remote.rulesReloadCooldownSource ☍

Seconds after a rules reload during which further reloadrules rows are marked done without reloading.

Servercityrp.remote.rulesSharedGraceSource ☍

Seconds a server = 'all' reloadrules row stays unmarked, so every server that shares the database polls it and acts before any of them marks it done.