lia.darkrp

A library of DarkRP compatibility functions.

Functions

findEmptyPos(startPos, entitiesToIgnore, maxDistance, searchStep, checkArea)

Finds an empty position within a certain distance from a starting position. This function searches for an empty position within a specified distance, checking multiple directions.

Parameters

  • startPos Vector

    The starting position to check.

  • entitiesToIgnore Table

    A table of entities to ignore during the check.

  • maxDistance Integer

    The maximum distance to search.

  • searchStep Integer

    The step size for the search.

  • checkArea Vector

    A vector defining the area around the position to check.

Returns

  • any

    Vector The found empty position, or the original position if none are found.

formatMoney(amount)

Formats an amount of money using the currency formatting function. This function formats the specified amount of money according to the currency system.

Parameters

  • amount Float

    The amount of money to be formatted.

Returns

  • any

    string The formatted money string.

isEmpty(position, entitiesToIgnore)

Checks if a position is empty, considering certain entity types and ignoring specified entities. This function determines if a position is clear of obstacles, entities, and certain content types.

Parameters

  • position Vector

    The position to check.

  • entitiesToIgnore Table

    A table of entities to ignore during the check.

Returns

  • any

    bool Whether the position is considered empty.

notify(client, _, _, message)

Sends a notification message to a client. This function sends a notification message to a specified client using the notify method.

Parameters

  • client

    The client to receive the notification.

  • _

    Unused argument.

  • _

    Unused argument.

  • message

    The message to be sent.

textWrap(text, fontName, maxLineWidth)

Wraps text to fit within a specified width, breaking lines where necessary. This function calculates the width of each character and word using the specified font, and inserts line breaks to ensure that no line exceeds the maximum width.

Parameters

  • text String

    The text string to be wrapped.

  • fontName String

    The font to be used for measuring text width.

  • maxLineWidth Integer

    The maximum width in pixels for each line of text.

Returns

  • any

    string The wrapped text with line breaks inserted.