โ๏ธ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
Place the resource folder in your FiveM resources directory
Add
ensure hate-backitemsto your server.cfgRestart your server
Commands
Basic Commands
/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 2Bone System
The system supports 4 attachment points:
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
Open
config.luaAdd a new language entry to
Config.LocalesTranslate all required strings
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:
System checks for existing custom position
If no custom position exists, opens position editor
Player can adjust position in real-time
Position is automatically saved when editor closes
Manual Position Editing
Players can re-edit positions by:
Equipping the weapon
Using the NUI interface to adjust position
Saving changes through the interface
Data Storage
Custom Weapons Storage
File:
data/custom_weapons.jsonContains: All dynamically added weapons with their configurations
Player Positions Storage
File:
data/player_positions.jsonContains: 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):trueto show items,falseto 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 = trueThis will show additional console messages for troubleshooting.
Development
Adding New Features
New Bones: Add bone hash to the bones table in
client.luaNew Languages: Add translation entry to
config.luaNew Commands: Register command in
client.luawith 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:
Check existing documentation
Verify configuration is correct
Check console for error messages
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