Skip to content

Rexshack-RedM/rsg-weaponcomp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rsg_framework

🔧 rsg-weaponcomp

Weapon components & customization (RSG Core).

Platform License

Open the customization flow with an item and load selections via inventory or /loadweapon. Includes camera helpers and menu pages for options.


🛠️ Dependencies

  • rsg-core (framework)
  • ox_lib (notifications & locale)
  • oxmysql (database)

License: GPL‑3.0


✨ What’s in this resource

  • Open event with item (uses a usable item to start the flow)
  • Basic functions
  • Functions apply (apply selected components/finishes)
  • Load for inventory or command/loadweapon and load selection in menu
  • Main Menu
  • Menu for options (components/finishes)
  • Function cam (helper camera)
  • Event cam (camera events)
  • Inspection extras
  • Extras others off for command
  • Start, Stop resource

✅ Verified in code:
Config.Gunsmithitem = 'gunsmith' (usable item)
Config.Gunsmithprop = \p_gunsmithprops09x`(placement prop) •Config.PaymentType = 'cash' | 'bloodmoney' • Server registers the **usable item** and provides **/loadweapon**. • No /w_inspect` command found in this repository.


⚙️ Configuration (config.lua)

Config = {}

Config.Debug           = true
Config.PlaceDistance   = 5.0
Config.RepairItem      = 'weapon_repair_kit'
Config.Gunsmithrobbery = 'lockpick'
Config.Gunsmithitem    = 'gunsmith'
Config.Gunsmithprop    = `p_gunsmithprops09x`
Config.MaxGunsites     = 1
Config.MaxWeapon       = 1
Config.PaymentType     = 'cash' -- or 'bloodmoney'

-- Camera offsets
Config.distBack = 0.7
Config.distSide = 0.13
Config.distUp   = 0.05
Config.distFov  = 60.0

Use the gunsmith item to open the customization flow. Use /loadweapon to reapply saved selections.


🕹️ Command

Command Description
/loadweapon Load/reapply current selection to the weapon in hand.

📂 Installation

  1. Drop rsg-weaponcomp in resources/[rsg].
  2. Ensure database (oxmysql) is running.
  3. Add to server.cfg:
    ensure ox_lib
    ensure oxmysql
    ensure rsg-core
    ensure rsg-weaponcomp
  4. Restart the server.

change inventory/html/app.js

generateTooltipContent(item) {
    if (!item) {
        return "";
    }

    let content = `<div class="custom-tooltip"><div class="tooltip-header">${item.label}</div><hr class="tooltip-divider">`;

    const description = item.info?.description?.replace(/\n/g, "<br>") 
        || item.description?.replace(/\n/g, "<br>") 
        || "No description available.";

    const renderInfo = (obj, indent = 0) => {
        let html = "";
        for (const [key, value] of Object.entries(obj)) {
            if (key === "description" || key === "lastUpdate" || key === "componentshash") continue;

            const padding = "&nbsp;".repeat(indent * 4);
            if (typeof value === "object" && value !== null && !Array.isArray(value)) {
                html += `<div class="tooltip-info"><span class="tooltip-info-key">${padding}${this.formatKey(key)}:</span></div>`;
                html += renderInfo(value, indent + 1);
            } else {
                html += `<div class="tooltip-info"><span class="tooltip-info-key">${padding}${this.formatKey(key)}:</span> ${value}</div>`;
            }
        }
        return html;
    };

    if (item.info && Object.keys(item.info).length > 0) {
        content += renderInfo(item.info);
    }

    content += `<div class="tooltip-description">${description}</div>`;
    content += `<div class="tooltip-weight"><i class="fas fa-weight-hanging"></i> ${item.weight != null ? (item.weight / 1000).toFixed(1) : "N/A"}kg</div>`;
    content += `</div>`;

    return content;
}

Version oficial or learning thanks


💎 Credits

About

rsg-weaponcomp for RSG RedM Framework

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 11

Languages