Qadr_Docs
  • qadr_identity
    • Installation
      • Reboot 2023
      • Old RedemRP
    • Purchasable ambients For Reboot Version
      • Blackwater Saloon
      • Valentine Saloon
      • Valentine Train Station
      • Saint Denis Bazaar
      • Saint Denis Prison
      • Saint Denis Trolley - Soon
  • qadr_fishing
  • qadr_panel
  • qadr_train
    • For Reboot 2023
  • Qadr_Map
  • qadr_ui
    • Ledger System
    • 📒Usable Handheld Catalogue
    • 🐴Legendary Animal Menu
    • 🤠Player Menu UI
    • ⏸️Pause Menu UI
    • ⚒️Crafting Menu UI
    • 🗺️Usable Legendary Animal Maps
    • 🗺️Map Icon
    • ⭕Meters UI
    • 🃏Ability UI
    • 👮‍♀️Wanted UI
    • 💀Death Screen
    • 📃Emote UI / Radial Menu
    • 🛒Shop Info UI
    • 🃏Card Game UI
    • 🤠Bounty Poster
    • 🛂Honor UI
    • 🗒️Challenge Notification Disable
    • 🎖️Mini Leader Board
    • 📋Board Notify
    • ⚔️Score UI
    • 👊Punch Bar
    • 🔄Count Down
    • 🚨Wanted UI - Outdated
    • 🌡️Meters UI - OutDated
    • 👁️‍🗨️Icons UI
    • 🗺️Map UI
      • Mini Map
      • Map Info
      • Hovered Blip Name
    • 🛡️Rank UI
    • 🐟Fish UI
      • 🎣Bait UI
    • ℹ️Info UI
    • 💥Mission Text UI
    • 🔫Weapon Info UI
    • 🐎Horse Info UI
    • 📔Message UI
    • 🤠Prompt Blip For Entities
  • qadr_train_creator - Standalone
Powered by GitBook
On this page
  • Note: The code provided cannot be used as an "Export." Therefore, you can access all the necessary examples and code in the client folder, specifically in the ledger.lua file.
  • Functions and Data Structures
  • Ledger Setup
  1. qadr_ui

Ledger System

Note: The code provided cannot be used as an "Export." Therefore, you can access all the necessary examples and code in the client folder, specifically in the ledger.lua file.

Previousqadr_uiNextUsable Handheld Catalogue

Last updated 8 months ago

This system manages the display of a ledger in an interactive way within a game. The code allows adding pages, handling page items, and responding to user interactions such as selecting or hovering over items.

Note: The code provided cannot be used as an "Export." Therefore, you can access all the necessary examples and code in the client folder, specifically in the ledger.lua file.

Functions and Data Structures

1. pageitem

The pageitem table represents a single item on a page in the ledger. This item includes properties such as visibility, title, notes, price, and event handlers for user interaction (select and hover events).

Code Example:

local pageitem = {
    visible = true,
    title = "HalfPageTop3",
    notes = "HalfPageTop_notes",
    sketchTexture = "ledger_camp_horse_station",
    crossedOut = false,
    price = {
        hovered = false,
        price = "$241",
        crossedOutTexture = "LEDGER_CAMP_LINE_04",
        highlighted = false,
    },
    onSelect = function(self)
        print("selected", self.title)
        print("selected", self.notes)
        self.crossed()
    end,
    onHovered = function(self)
        print("Hovered", self.title)
        print("Hovered", self.notes)
    end
}

Description:

  • visible: Determines whether the item is visible on the page.

  • title: The title of the page item.

  • notes: Notes or additional information related to the item.

  • sketchTexture: The texture used to display the sketch image on the page.

  • crossedOut: Boolean to indicate if the item should appear as crossed out.

  • price: Contains details about the item's price, including hover status and whether it's highlighted or crossed out.

    • hovered: Indicates if the price is currently hovered.

    • price: The actual price of the item, in this case, $241.

    • crossedOutTexture: The texture used when the item is crossed out.

    • highlighted: Indicates if the price is highlighted.

Event Handlers:

  • onSelect: Function triggered when the item is selected by the user. It prints the title and notes, and calls the crossed function.

  • onHovered: Function triggered when the item is hovered by the user. It prints the title and notes.


2. contribution

The contribution table represents a contribution entry in the ledger. It includes the contributor’s name, visibility, price, and description.

Code Example:

local contribution = {
    name = "Wyatt Earp",
    visible = true,
    price = 81,
    description = "Sheriff's fee",
}

Description:

  • name: The name of the contributor (in this case, Wyatt Earp).

  • visible: Determines if the contribution entry is visible.

  • price: The amount of the contribution ($81).

  • description: A description of the contribution (Sheriff’s fee).


3. fullPageUpgrade

This table represents an upgrade that can be displayed on a full page. It includes details such as visibility, title, crossed-out status, notes, and price information.

Code Example:

local fullPageUpgrade = {
    visible = true,
    title = "Upgrades 1 Title",
    crossedOut = false,
    crossedOutTexture = "ledger_camp_line_04",
    notes = "Upgrades Note 1",
    price = {
        hovered = true,
        price = "10",
        crossedOutTexture = "LEDGER_CAMP_LINE_04",
        highlighted = false,
    },
    onSelect = function(self)
        print("selected", self.title)
        print("selected", self.notes)
        self.crossed()
    end,
    onHovered = function(self)
        print("Hovered", self.title)
        print("Hovered", self.notes)
    end
}

Description:

  • visible: Determines if the upgrade is visible.

  • title: The title of the upgrade.

  • crossedOut: Indicates whether the upgrade is crossed out.

  • crossedOutTexture: The texture to use when the upgrade is crossed out.

  • notes: Additional notes about the upgrade.

  • price: Contains price information for the upgrade.

    • hovered: Indicates if the price is hovered.

    • price: The cost of the upgrade.

    • crossedOutTexture: The texture used if the price is crossed out.

    • highlighted: Whether the price is highlighted.

Event Handlers:

  • onSelect: Prints the selected upgrade's title and notes, and calls the crossed function.

  • onHovered: Prints the hovered upgrade's title and notes.


4. fullPageReStock

The fullPageReStock table defines an item in the restock section of a full page. It handles whether the item is crossed out, hovered, and its price.

Code Example:

local fullPageReStock = {
    index = 1,
    crossedOut = false,
    hovered = false,
    price = "33",
    crossedOutTexture = "LEDGER_CAMP_LINE_04",
    highlighted = false,
    onSelect = function(self)
        print("index", self.index)
        print("price", self.price)
        self.crossed()
    end,
    onHovered = function(self)
        print("index", self.index)
        print("price", self.price)
    end
}

Description:

  • index: The index of the restock item.

  • crossedOut: Whether the item is crossed out.

  • hovered: Whether the item is hovered.

  • price: The price of the restock item.

  • crossedOutTexture: The texture used if the item is crossed out.

  • highlighted: Whether the price is highlighted.

Event Handlers:

  • onSelect: Prints the selected restock item's index and price, and calls the crossed function.

  • onHovered: Prints the hovered restock item's index and price.


Ledger Setup

Adding Pages

The ledger function allows the creation of ledger pages and adding different types of pages to it. Pages can be of type PageItems, ContPage, or FullPage, each with its own structure.

Code Example:

RegisterCommand("ledger",function()
    local ledgers = ledger({
        {
            coords = vector3(-323.06, 803.4, 117.9306),
            rots = vector3(0, 0, 99.88),
            name = "Ledger Name",
        },
        {
            coords = vector3(-326.1, 797.38, 117.72),
            rots = vector3(0, 0, 99.9),
            name = "Ledger Name2",
        },
        {
            coords = vector3(-282.62, 779.85, 119.58),
            rots = vector3(0, 0, 180.0),
            name = "Ledger Name3",
        },
    })

    local PageItems = {
        pageType = "PageItems",
        items = {
            pageitem,
            pageitem,
        }
    }
    ledgers:addPage(PageItems)

    local ContPage = {
        pageType = "ContPage",
        visible = true,
        title = "Title 1",
        carried = {
            visible = true,
        },
        contributions = {
            contribution,
            contribution
        },
        total = {
            visible = true
        }
    }
    ledgers:addPage(ContPage)

    local FullPage = {
        pageType = "FullPage",
        visible = true,
        title = "Title 2",
        subTitle = "SubTitle 2",
        sketchTexture = "ledger_camp_munitions",
        upgrades = { fullPageUpgrade, fullPageUpgrade },
        restock = { fullPageReStock, fullPageReStock },
    }
    ledgers:addPage(FullPage)
end)

Event Handling

The script also registers event handlers for various actions such as selecting or hovering over ledger items, as well as entering or exiting a volume around a ledger. Below are the event handlers implemented in the code:

Event Example:

luaCopy codeAddEventHandler("qadr_ui:ledger_selectedItem", function(data)
    print("qadr_ui:ledger_selectedItem")
end)

AddEventHandler("qadr_ui:ledger_hovered", function(data)
    print("qadr_ui:ledger_hovered")
end)

AddEventHandler("qadr_ui:ledger_in_volume", function(data)
    print("qadr_ui:ledger_in_volume")
    tablePrint(data, "ledger_in_volume")
end)

AddEventHandler("qadr_ui:ledger_out_volume", function(data)
    print("qadr_ui:ledger_out_volume")
    tablePrint(data, "ledger_out_volume")
end)

Descriptions:

  • qadr_ui:ledger_selectedItem: Triggered when an item in the ledger is selected. The data returned contains information about the selected item.

  • qadr_ui:ledger_hovered: Triggered when an item in the ledger is hovered over. The data returned contains information about the hovered item.

  • qadr_ui:ledger_in_volume: Triggered when the player enters a specific volume around the ledger. The data returned contains information about the volume, and the player can start interacting with the ledger. For example, you might display a prompt to the player when they enter the volume.

  • qadr_ui:ledger_out_volume: Triggered when the player exits a volume around the ledger. The data returned contains information about the volume, and you can use this event to remove any prompts or interaction options when the player leaves the area.


qadr_ui / Ledger