โš”๏ธBackItems

Overview

The BackItems system is a comprehensive FiveM resource that supports both QBCore and ESX frameworks, allowing players to dynamically add and manage weapon attachments on their character's back. The system supports multiple attachment bones, custom positioning, multi-language support, and real-time position editing.

Features

  • Multi-Framework Support: Compatible with QBCore and ESX frameworks (auto-detection)

  • Dynamic Weapon Addition: Add any weapon not defined in BackItems.lua

  • Multiple Bone Attachments: Support for 4 different attachment points (Spine, Pelvis, Left Leg, Right Leg)

  • Custom Positioning: Real-time position editing with preview

  • Multi-Language Support: English (default) and Turkish with extensible language system

  • Persistent Storage: Custom weapons and positions saved automatically

  • Chat Integration: User-friendly chat commands with color-coded messages

Framework Support

Supported Frameworks

  • QBCore: Full integration with QBCore framework

  • ESX: Full integration with ESX framework

  • Auto-Detection: Automatically detects which framework is running

Configuration

Set your framework in config.lua:

Config.Framework = 'auto'  -- 'qbcore', 'esx', or 'auto'

Installation

  1. Place the resource folder in your FiveM resources directory

  2. Add ensure hate-backitems to your server.cfg

  3. Restart your server

Commands

Basic Commands

Command
Description
Usage

/backitem_reload

Reload

/backitem_reload

/backitem_bones

List all available bones

/backitem_bones

/backitem_add

Add a new custom weapon

/backitem_add [weapon_name] [weaponmodel] [bone]

/backitem_changebone

Change weapon attachment bone

/backitem_changebone [weapon_name] [bone_id]

Examples

/backitem_add weapon_glock22 w_pi_glock22 2
/backitem_changebone weapon_glock22 2

Bone System

The system supports 4 attachment points:

Bone ID
Name
Hash
Description

1

Spine

24818

Upper back attachment

2

Pelvis

11816

Hip/waist attachment

3

Left Leg

36029

Left thigh attachment

4

Right Leg

51826

Right thigh attachment

Adding New Languages

  1. Open config.lua

  2. Add a new language entry to Config.Locales

  3. Translate all required strings

  4. Language will be automatically available

Example:

Config.Locales.es = {
    weapon_list_header = "Armas Disponibles:",
    bone_list_header = "Huesos Disponibles:",
    -- ... other translations
}

Configuration

BackItems.lua Functions

-- Check if weapon exists
WeaponExists(weaponName)

-- Get all weapons list
GetAllWeapons()

-- Add new weapon configuration
AddNewWeapon(weaponName, boneHash, position, rotation)

Custom Weapon Configuration

When adding a new weapon, the system automatically creates a configuration with:

  • Default Bone: Spine (24818)

  • Default Position: {x = 0.0, y = 0.0, z = 0.0}

  • Default Rotation: {x = 0.0, y = 0.0, z = 0.0}

Position Editing

Automatic Position Editing

When a player equips a weapon:

  1. System checks for existing custom position

  2. If no custom position exists, opens position editor

  3. Player can adjust position in real-time

  4. Position is automatically saved when editor closes

Manual Position Editing

Players can re-edit positions by:

  1. Equipping the weapon

  2. Using the NUI interface to adjust position

  3. Saving changes through the interface

Data Storage

Custom Weapons Storage

  • File: data/custom_weapons.json

  • Contains: All dynamically added weapons with their configurations

Player Positions Storage

  • File: data/player_positions.json

  • Contains: Individual player position preferences for each weapon

Event System

Core Events

backitems:displayItems

Controls the visibility of back items for debugging and administrative purposes.

Usage:

-- Hide all back items
TriggerClientEvent("backitems:displayItems",false)

-- Show all back items
TriggerClientEvent("backitems:displayItems",true)

Parameters:

  • toggle (boolean): true to show items, false to hide items

Description: This event allows administrators to globally control the visibility of back items. When set to false, all current back items are temporarily removed and stored. When set to true, the stored items are restored and the BackLoop continues normal operation.

Use Cases:

  • Debugging positioning issues

  • Administrative control during events

  • Testing new configurations

  • Troubleshooting client performance

backitems:start

Manually starts the BackItems system with a delay.

Usage:

-- Start BackItems system with 5-second delay
TriggerEvent("backitems:start")

Description: This event manually triggers the BackItems system to start after a 5-second delay. It's primarily used for:

  • Manual system initialization

  • Restarting after system stops

  • Development and testing purposes

Note: The system normally starts automatically when a player loads, so this event is mainly for special circumstances.

Troubleshooting

Common Issues

Weapon not appearing

  • Check if weapon name is correct

  • Verify weapon exists in game

  • Check console for errors

Position not saving

  • Ensure player has permission to save positions

  • Check file permissions for data directory

  • Verify JSON file structure

Language not changing

  • Check if language code is supported

  • Verify Config.Locales contains the language

  • Restart resource if needed

Debug Mode

Enable debug mode in client.lua:

local debugMode = true

This will show additional console messages for troubleshooting.

Development

Adding New Features

  1. New Bones: Add bone hash to the bones table in client.lua

  2. New Languages: Add translation entry to config.lua

  3. New Commands: Register command in client.lua with proper error handling

Code Structure

  • client.lua: Main client logic, UI handling, position management

  • server.lua: Data persistence, player synchronization

  • BackItems.lua: Core weapon configurations and helper functions

  • config.lua: Centralized configuration and language system

Support

For issues, feature requests, or contributions:

  1. Check existing documentation

  2. Verify configuration is correct

  3. Check console for error messages

  4. Test with default settings

License

This resource is provided as-is for FiveM community use. Please respect the original author's work and provide appropriate attribution when modifying or redistributing.

Last updated