N Sling

N Sling

In-game sling editor. Admins place inventory items on the character with a translate / rotate gizmo and an orbit camera. Positions are saved from the NUI panel (JSON or database). Lua config stays small on purpose.

⚠️

This resource supports by default ESX, QB, QBOX, ox_core, vRP and standalone (ACE). For any other framework please contact me on discord (opens in a new tab).

⚠️

Dependencies

Inventory is auto-detected (ox_inventory, qb-inventory, qs-inventory, and others — confirm it in the first-run wizard).

Installation

Make sure you already have a supported inventory

First started resource wins. You can override it in the setup wizard.

  • ox_inventory (opens in a new tab)
  • qb-inventory / ps-inventory / lj-inventory
  • qs-inventory / origen_inventory / codem-inventory / tgiann-inventory
  • core_inventory / chezza / jaksam
  • ESX default items (fallback)

Unpack the resource n_sling into your resources folder

    • server.cfg
    • Resource start order

      It's important for your resources to start in a logical order to prevent errors from missing dependencies.

      ensure oxmysql # only if Config.Save = 'database'
      ensure inventory # ox_inventory, qb-inventory, qs-inventory, ...
      ensure n_sling

      Ace Permissions

      add_ace group.admin command.sling allow
      add_ace group.admin n_sling.admin allow

      ACE always works (including standalone). Framework groups in Config.Admin.Groups are checked after ACE.

      If you change Config.Command, the command ACE follows it (command.<Command>).

      Config

      Resource configuration is handled using config.lua. Everything else — inventory, image path, theme, keybinds, slings — is set in the panel.

      Config = {}
       
      --- 'json' writes data/store.json
      --- 'database' uses oxmysql table `n_sling` (created automatically)
      Config.Save = 'json'
       
      --- Chat command that opens the editor. ACE object defaults to command.<this>
      Config.Command = 'sling'
       
      Config.Admin = {
          Groups = { 'admin', 'superadmin', 'god', 'mod' },
          Ace = 'n_sling.admin',
          -- Export = { resource = 'my_admin', name = 'IsSlingAdmin' },
      }

      SQL Schema

      • Only needed when Config.Save = 'database'.
      • Table n_sling is created on first start. You do not have to import SQL by hand.
      • If oxmysql is missing, the resource falls back to JSON and prints a warning.
      CREATE TABLE IF NOT EXISTS `n_sling` (
          `id` TINYINT NOT NULL PRIMARY KEY,
          `payload` LONGTEXT NOT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

      JSON file: n_sling/data/store.json. Back it up; a resource update can overwrite the default empty file if you replace the folder.

      First start

      Open the panel with /sling (or Config.Command).

      If setup is not completed, a wizard opens:

      1. Confirm the auto-detected inventory (or pick another).
      2. Confirm the image path (pre-filled from the inventory).
      3. Set theme colours (default primary 250, 143, 20).

      After that the panel lists every configured sling. Images are imagesPath + '/' + item image.

      If an item has no model and is not a weapon, set Model override in the add dialog (w_ar_carbinerifle, prop_…, etc.).

      Editor

      Placement uses the same DRAW_GIZMO method as object_gizmo (opens in a new tab) (built in — object_gizmo does not need to be started).

      Add sling → pick an item and a slot → the panel hides, the item spawns on you.

      DefaultAction
      GToggle gizmo cursor
      WTranslate
      RRotate
      QLocal / world space
      [ ]Cycle attach bone
      LMBGrab the gizmo (cursor on)
      RMBOrbit camera (cursor off)
      ScrollZoom
      EnterSave (deletes preview, restores panel)
      Backspace / EscCancel

      Helper HUD in the corner lists whatever keybinds you saved in Settings.

      Runtime

      Configured slings attach on players who have that item. The equipped copy in hands is hidden; putting the weapon away shows the sling again.

      Props are networked, same as n_snippets bags. You create one object on your own ped, attach it, and the server keeps the net id. Other clients do not spawn copies — OneSync streams the entity. That is what stops a third player from seeing doubles.

      Settings → Spawn delay (default 3 seconds) waits after you spawn / character load before creating your objects.

      Clothing Hide is local invisibility; other players still see your sling. Dropping the item or logout deletes the networked entity for everyone. See Integrations, Exports and Handlers.

      Inventories

      Detection order (first started resource wins). Confirm or override in the setup wizard.

      InventoryResourceImages
      ox_inventoryox_inventorynui://ox_inventory/web/images
      qs-inventoryqs-inventorynui://qs-inventory/html/images
      origen_inventoryorigen_inventorynui://origen_inventory/html/images
      codem-inventorycodem-inventorynui://codem-inventory/html/itemimages
      tgiann-inventorytgiann-inventorynui://tgiann-inventory/nui/images
      core_inventorycore_inventorynui://core_inventory/html/img
      ps-inventoryps-inventorynui://ps-inventory/html/images
      lj-inventorylj-inventorynui://lj-inventory/html/images
      qb-inventoryqb-inventorynui://qb-inventory/html/images
      chezzainventorynui://inventory/html/images
      jaksamjaksam_inventorynui://jaksam_inventory/html/images
      ESX fallbackes_extendedset in setup

      Some tgiann packs use a separate inventory_images resource — set the path in setup if so.

      Using an unsupported framework

      If your framework does not have official support, open a ticket at Discord (opens in a new tab).

      You can also plug your own admin check:

      Config.Admin.Export = { resource = 'my_admin', name = 'IsSlingAdmin' }
      exports('IsSlingAdmin', function(source)
          return true -- your check
      end)

      The export is called even if the detected framework is not custom. ACE still applies.

      Join Our Discord