Dapler Docs
StoreDiscord
  • Welcome
  • SCRIPTS
    • Bridge
      • Installation
      • File Structure
      • Usage
      • Client-side Exports
      • Server-side Exports
    • Notify
      • Installation guide
  • Speech Recognition
    • Installation
    • Requirements
    • Configuration
    • Microphone Access
    • License and Conditions
    • Support
  • Events
Powered by GitBook
On this page
  • Core Exports
  • Extras
  • Interaction
  • UI
  • Shared Utils
  1. SCRIPTS
  2. Bridge

Client-side Exports

dr-bridge provides a variety of client-side exports that can be accessed and used in other scripts. Below is a detailed breakdown of all the available exports, including input formats, return values,

Core Exports

  1. GetPlayerData()

    • Description: Returns the player's data, including their job, money, items, etc.

    • Input: None.

    • Output: Returns a table containing:

      {
        citizenid = string,  -- Player's citizen ID.
        job = table,         -- Player's current job data (e.g., { name = "police", grade = "officer" }).
        money = table,       -- Player's money data (e.g., { cash = 1000, bank = 5000 }).
        metadata = table,    -- Player's metadata (varies depending on the framework).
        items = table        -- Player's inventory (e.g., { { name = "water", count = 5 }, ... }).
      }
  2. GetJob()

    • Description: Returns the player's current job.

    • Input: None.

    • Output: Returns a table:

      {
        name = string,    -- Job name (e.g., "police").
        grade = string,   -- Job grade (e.g., "officer").
      }
  3. GetMoney(account)

    • Description: Returns the player's balance for a specific account (default is "cash").

    • Input: account (string, optional) - the account type (e.g., "cash", "bank").

    • Output: Returns a number representing the player's balance for the specified account.

  4. HasItem(item, count)

    • Description: Checks if the player has a specific item and quantity.

    • Input:

      • item (string): Item name (e.g., "water", "weapon_pistol").

      • count (number, optional): Item count. Default is 1.

    • Output: Returns boolean (true or false).

  5. Notify(text, type)

    • Description: Displays a notification to the player.

    • Input:

      • text (string): The text to display.

      • type (string, optional): Notification type (e.g., "info", "success", "error"). Default is "info".

    • Output: None (displays a notification).

  6. IsDead()

    • Description: Checks if the player is dead.

    • Input: None.

    • Output: Returns boolean (true if the player is dead, false otherwise).

  7. GetCoords()

    • Description: Returns the player's current coordinates.

    • Input: None.

    • Output: Returns a vector3:

      { x = number, y = number, z = number }
  8. IsInVehicle()

    • Description: Checks if the player is in a vehicle.

    • Input: None.

    • Output: Returns boolean (true if the player is in a vehicle, false otherwise).

  9. GetPed()

    • Description: Returns the player's Ped ID.

    • Input: None.

    • Output: Returns a number (the player's Ped ID).

  10. TriggerCallback(name, cb, ...) Description: Triggers a server callback and returns the result to the client callback function. Works with both QBCore and ESX via dr-bridge. Input:

    • name (string): The name of the server callback to trigger.

    • cb (function): A function that receives the result from the server.

    • ... (any): Additional arguments passed to the server callback.

    Output: None (calls the callback function with the result).

    Example:

    exports['dr-bridge']:TriggerCallback('my:getMoney', function(result)
        print("Money:", result)
    end)

Extras

  1. Show3DText(coords, text, scale)

  • Description: Displays 3D text at the given coordinates.

  • Input:

    • coords (vector3): Coordinates where the text will appear.

    • text (string): The text to display.

    • scale (number, optional): The scale of the text. Default is 0.35.

  • Output: None (displays the text).

  1. AddBlip(coords, sprite, color, scale, label)

    • Description: Adds a blip to the map at the specified coordinates.

    • Input:

      • coords (vector3): The position of the blip.

      • sprite (number): The sprite ID for the blip.

      • color (number): The color of the blip.

      • scale (number, optional): The scale of the blip. Default is 0.8.

      • label (string): The label text of the blip.

    • Output: Returns a number (blip ID).

  2. DrawMarker(coords, type, scale, color)

    • Description: Draws a marker at the specified coordinates.

    • Input:

      • coords (vector3): Coordinates of the marker.

      • type (number, optional): Type of the marker (default is 1).

      • scale (vector3): The scale of the marker.

      • color (table): The color of the marker in {r, g, b, a} format.

    • Output: None (draws the marker).

  3. PlayAnim(dict, anim, flag)

    • Description: Plays an animation on the player.

    • Input:

      • dict (string): The animation dictionary.

      • anim (string): The animation name.

      • flag (number, optional): The animation flag (default is 1).

    • Output: None (plays the animation).

  4. ShowHelpNotification(text)

    • Description: Shows a help notification on the screen.

    • Input:

      • text (string): The text to display in the notification.

    • Output: None (displays the help notification).

  5. ShowNotification(text)

    • Description: Shows a basic notification at the top of the screen.

    • Input:

      • text (string): The text to display.

    • Output: None (displays the notification).


Interaction

  1. AddTargetEntity(entity, options)

    • Description: Adds a target interaction to a specific entity.

    • Input:

      • entity (number): The entity ID.

      • options (table): Options for the interaction.

    • Output: None (adds the interaction).

  2. AddTargetModel(model, options)

    • Description: Adds a target interaction to a specific model.

    • Input:

      • model (number): The model ID.

      • options (table): Options for the interaction.

    • Output: None (adds the interaction).

  3. AddTargetZone(zone, options)

    • Description: Adds a target interaction to a specific zone.

    • Input:

      • zone (table): The zone's coordinates and dimensions.

      • options (table): Options for the interaction.

    • Output: None (adds the interaction).

  4. RemoveTargetEntity(entity)

    • Description: Removes a target interaction from a specific entity.

    • Input:

      • entity (number): The entity ID.

    • Output: None (removes the interaction).

  5. RemoveTargetModel(model)

    • Description: Removes a target interaction from a specific model.

    • Input:

      • model (number): The model ID.

    • Output: None (removes the interaction).

  6. RemoveTargetZone(zone)

    • Description: Removes a target interaction from a specific zone.

    • Input:

      • zone (table): The zone's coordinates and dimensions.

    • Output: None (removes the interaction).

  7. UpdateTargetOptions(options)

    • Description: Updates the options for target interactions.

    • Input:

      • options (table): New options for the interaction.

    • Output: None (updates the options).


UI

  1. ShowTextUI(text, position)

    • Description: Displays text UI at a specified position on the screen.

    • Input:

      • text (string): The text to display.

      • position (string, optional): The position of the text (default is "left").

    • Output: None (displays the text).

  2. HideTextUI()

    • Description: Hides the displayed text UI.

    • Input: None.

    • Output: None (hides the text).


Shared Utils

  1. DebugPrint(message)

    • Description: Prints a debug message to the console if debug mode is enabled.

    • Input:

      • message (string): The message to print.

    • Output: None (prints the message to the console).

  2. TableHasValue(table, value)

    • Description: Checks if a table contains a specific value.

    • Input:

      • table (table): The table to search in.

      • value (any): The value to search for.

    • Output: Returns boolean (true if the value exists, false otherwise).

  3. DeepCopy(table)

    • Description: Creates a deep copy of a table.

    • Input:

      • table (table): The table to copy.

    • Output: Returns a new table that is a deep copy of the input table.

  4. Round(number, decimals)

    • Description: Rounds a number to a specified number of decimal places.

    • Input:

      • number (number): The number to round.

      • decimals (number, optional): The number of decimal places to round to. Default is 0.

    • Output: Returns a number (rounded value).

  5. IsTable(value)

    • Description: Checks if the given value is a table.

    • Input:

      • value (any): The value to check.

    • Output: Returns boolean (true if the value is a table, false otherwise).

  6. WaitForCondition(condition)

    • Description: Waits until a specified condition is met.

    • Input:

      • condition (function): The condition to check (should return true when met).

    • Output: None (waits for the condition).

PreviousUsageNextServer-side Exports

Last updated 2 months ago