Skip to content

DarkRP

DarkRP compatibility helpers for Lilia, including spawn position checks, DarkRP-style notifications, currency formatting, entity item generation, command registration adapters, door keyvalue handling, and RPExtraTeams synchronization.


Overview

The DarkRP compatibility library provides shim functions and tables expected by DarkRP-style addons while routing supported behavior through Lilia systems. It exposes `lia.darkrp` helpers for empty-position checks, text wrapping, notifications, currency formatting, entity item registration, and category compatibility, then maps selected helpers onto the global `DarkRP` table for addon compatibility.

lia.darkrp.isEmpty(position, entitiesToIgnore)View Source

Purpose

Checks whether a position is clear of solid contents and nearby blocking entities.

Realm

Server

Parameters

Vector position The world position to check.

table entitiesToIgnore optional Optional list of entities that should not cause the position to be considered occupied.

Returns

boolean True if the position is clear, false otherwise.

Example Usage

  local position = lia.darkrp.isEmpty(client:GetPos(), {client})
  print(position)

lia.darkrp.findEmptyPos(startPos, entitiesToIgnore, maxDistance, searchStep, checkArea)View Source

Purpose

Finds the nearest clear position around a starting point by checking offsets along each axis.

Realm

Server

Parameters

Vector startPos The preferred world position.

table entitiesToIgnore optional Optional list of entities ignored by the occupancy checks.

number maxDistance The maximum distance from the starting position to search.

number searchStep The distance increment used while searching outward.

Vector checkArea Additional offset checked from each candidate position to confirm clearance.

Returns

Vector The first clear position found, or the starting position if no clear offset is found.

Example Usage

  local position = lia.darkrp.findEmptyPos(client:GetPos(), {client}, 600, 30, Vector(0, 0, 72))
  client:SetPos(position)

lia.darkrp.notify(client, notifyType, duration, message)View Source

Purpose

Sends a DarkRP-compatible notification through Lilia's localized notification system.

Realm

Server

Parameters

Player client The player receiving the notification.

number|string notifyType optional DarkRP notification type value accepted for compatibility but not used by this shim.

number duration optional DarkRP notification duration accepted for compatibility but not used by this shim.

string message The localization key or message passed to the notification system.

Example Usage

  lia.darkrp.notify(client, 0, 4, "someLocalizationKey")

lia.darkrp.textWrap(text, fontName, maxLineWidth)View Source

Purpose

Wraps text to fit within a maximum pixel width using Garry's Mod surface font measurements.

Realm

Client

Parameters

string text The text to wrap.

string fontName The surface font used to measure the text.

number maxLineWidth The maximum line width in pixels.

Returns

string The wrapped text with newline breaks inserted where needed.

Example Usage

  local text = lia.darkrp.textWrap("Long text", "DermaDefault", 200)
  print(text)

lia.darkrp.formatMoney(amount)View Source

Purpose

Formats a numeric amount using Lilia's configured currency formatter.

Realm

Shared

Parameters

number amount The amount of money to format.

Returns

string The formatted currency string.

Example Usage

  client:notifyInfo(lia.darkrp.formatMoney(250))
  print(lia.darkrp.formatMoney(1))

lia.darkrp.createEntity(name, data)View Source

Purpose

Registers a DarkRP-style entity definition as a Lilia item using the `base_entities` item base.

Realm

Shared

Parameters

string name The display name of the entity item.

table data Entity definition data.

Example Usage

  lia.darkrp.createEntity("Money Printer", {
      ent = "money_printer",
      model = "models/props_c17/consolebox01a.mdl",
      price = 500
  })

lia.darkrp.createCategory()View Source

Purpose

Provides a no-op DarkRP category compatibility function.

Realm

Shared

Example Usage

  lia.darkrp.createCategory()

Hooks

Library-specific hooks documented for this library.


EntityKeyValue(entity, key, value)View Source

Purpose

Applies supported DarkRP door keyvalues to Lilia door data when map entities receive key-value pairs.

Realm

Server

Parameters

Entity entity The entity receiving the keyvalue.

string key The keyvalue name being applied.

string value The keyvalue value being applied.


InitializedModules()View Source

Purpose

Copies Lilia faction indices into `RPExtraTeams` and assigns each copied faction its DarkRP-compatible team index.

Realm

Shared