> For the complete documentation index, see [llms.txt](https://hate-development.gitbook.io/hate-development-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hate-development.gitbook.io/hate-development-docs/global-shop.md).

# Global Shop

A comprehensive marketplace system for FiveM servers that allows players to buy and sell items through a global marketplace interface.

## Features

* Global marketplace system with real-time updates
* Support for multiple frameworks (ESX and QB-Core)
* Support for multiple inventory systems (ox\_inventory, core\_inventory, qs-inventory, codem-inventory)
* Transaction fee system with configurable rates
* Item metadata support
* Blacklist system for restricted items
* Multiple market locations with blips
* Transaction history tracking
* Balance system for sellers
* Multi-language support
* Modern and responsive UI

## Installation

1. Download the resource
2. Import the `sql/marketplace.sql` file into your database
3. Add the following to your server.cfg:

```cfg
ensure hate-globalshop
```

## Configuration

### Framework Selection

```lua
Config.Framework = "QB" -- Options: "ESX" or "QB"
```

### Inventory System

```lua
Config.Inventory = "ox_inventory" -- Options: "ox_inventory", "core_inventory", "qs-inventory", "codem-inventory"
```

### Market Locations

```lua
Config.MarketLocations = {
    {
        coords = vector3(720.18, 1278.09, 360.3),
        radius = 3.0 -- Distance in meters player needs to be within
    }
    -- Add more locations as needed
}
```

### Transaction Fee Settings

```lua
Config.TransactionFee = 10 -- Percentage fee taken from each sale (e.g., 10 means 10%)
Config.EnableFee = true -- Set to false to disable transaction fees
Config.FeeAccount = nil -- Set to a player identifier to direct all fees to this account
```

### Currency Settings

```lua
Config.CurrencySymbol = "քք  " -- Currency symbol to display
Config.CurrencySymbolPosition = "before" -- 'before' or 'after' the amount
```

### Item as Money System

```lua
Config.UseItemAsMoney = false -- Set to true to use items as currency
Config.MoneyItem = "tuning_component" -- The item to use as currency
```

### Blacklisted Items

```lua
Config.BlacklistedItems = {
    "weapon_pistol",
    "loot_dvd",
    "black_money",
    "lockpick",
    "advancedlockpick"
}
```

### Language Settings

```lua
Config.Language = "en" -- Default language (en, tr, de, etc.)
```

## Exports

### Client Exports

```lua
-- Open the marketplace
exports['hate-globalshop']:openMarket()
-- Returns true if market opened successfully, false otherwise

-- Check if player can open the market
exports['hate-globalshop']:canOpenMarket()
-- Returns true/false and message explaining why market can't be opened

exports['hate-globalshop']:GetMarketBalance()
-- Returns the player's current market balance

exports['hate-globalshop']:GetPlayerInventory()
-- Returns the player's current inventory items
```

### Server Exports

```lua
-- Open the marketplace for a specific player
exports['hate-globalshop']:openPlayerMarket(playerId)
-- Opens the market for the specified player

exports['hate-globalshop']:GetMarketBalance(source)
-- Returns a player's market balance by source

exports['hate-globalshop']:GetPlayerInventory(source)
-- Returns a player's inventory by source
```

### Events

#### Client Events

```lua
-- Open the marketplace
TriggerEvent('hate-globalshop:openMarket')
-- or
TriggerEvent('hate-globalshop:client:openMarket')
```

#### Server Events

```lua
-- Open the marketplace for a specific player
TriggerEvent('hate-globalshop:server:openMarket', playerId)

-- Open the marketplace for the triggering player
TriggerEvent('hate-globalshop:server:openMarket')
```

## Commands

### Player Commands

```
/globalmarket -- Open the marketplace interface (default key binding: F6)
```

## Notes

* The script is protected with escrow encryption
* Client and server files are encrypted
* Only config.lua, server/framework.lua, and client/marketplace.lua are accessible for customization
* The script supports multiple inventory systems and frameworks
* Transaction fees can be configured and directed to specific accounts
* The marketplace supports item metadata preservation

## Security Notice

This script is protected by FiveM's escrow system. The client and server-side code is encrypted and cannot be modified.
