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

# How to Install

FiveStar Script

### Requirements

Before starting, make sure you have the latest version of **oxmysql** Script installed on your server

You can fully customize the config file and customize or change the **ox\_target** or **ox\_lib or ox\_innvetory or qb-inventory or ps-inventory** scripts

{% embed url="<https://github.com/overextended/ox_target>" fullWidth="false" %}

{% embed url="<https://github.com/qbcore-framework/qb-inventory>" %}

{% embed url="<https://github.com/Project-Sloth/ps-inventory>" %}

{% embed url="<https://github.com/overextended/ox_inventory>" fullWidth="false" %}

{% embed url="<https://github.com/overextended/oxmysql>" fullWidth="false" %}

{% embed url="<https://github.com/overextended/ox_lib>" fullWidth="false" %}

{% tabs %}
{% tab title="ox\_invnetory" %}

### Add Export

Open the **ox\_innvetory script** Find the function `client.closeInventory` in **ox\_invnetory** and add the **export** FiveStar-MissionClub

{% code title="ox\_inventory/client.lua" %}

```lua
function client.closeInventory(server)
	exports["FiveStar-MissionClub"]:closeInventory()
	-- .... 
end
```

{% endcode %}

### Add Icons Item

Add icon items in `ox_inventory/web/images` or your **custome inventory**

### Add Items Data

Add items data in **`ox_inventory/data/items.lua`** or **custome inventory**
{% endtab %}

{% tab title="qb-invnetory - ps-inventory" %}

### Add Export

Open the qb-**inventory script f**ind the function `client.closeInventory` and Register nui call back `CloseInventory`  in **ox\_invnetory** and add the **export** FiveStar-MissionClub

{% code title="qb-inventory/client/main.lua" %}

```lua
---Closes the inventory NUI
local function closeInventory()
    exports["FiveStar-MissionClub"]:closeInventory()
    SendNUIMessage({
        action = "close",
    })
end

RegisterNUICallback("CloseInventory", function()
    exports["FiveStar-MissionClub"]:closeInventory()
    ...
end)
```

{% endcode %}

### Add to stash item

<mark style="color:red;">**qb-inventory does not have the ability to add item to stash automatically**</mark>, find the register net event `inventory:server:OpenInventory` and <mark style="color:green;">**replace the code**</mark>

<pre class="language-lua"><code class="lang-lua">RegisterNetEvent('inventory:server:OpenInventory', function(name, id, other, items)
<strong>	local src = source
</strong>	local ply = Player(src)
	local Player = QBCore.Functions.GetPlayer(src)
	if not ply.state.inv_busy then
		if name and id then
			local secondInv = {}
			if name == "stash" then
				if Stashes[id] then
					if Stashes[id].isOpen then
						local Target = QBCore.Functions.GetPlayer(Stashes[id].isOpen)
						if Target then
							TriggerClientEvent('inventory:client:CheckOpenState', Stashes[id].isOpen, name, id, Stashes[id].label)
						else
							Stashes[id].isOpen = false
						end
					end
				end
				local maxweight = 1000000
				local slots = 50
				if other then
					maxweight = other.maxweight or 1000000
					slots = other.slots or 50
				end
				secondInv.name = "stash-"..id
				secondInv.label = "Stash-"..id
				secondInv.maxweight = maxweight
				secondInv.inventory = {}
				secondInv.slots = slots
				if Stashes[id] and Stashes[id].isOpen then
					secondInv.name = "none-inv"
					secondInv.label = "Stash-None"
					secondInv.maxweight = 1000000
					secondInv.inventory = {}
					secondInv.slots = 0
				else
					local stashItems = GetStashItems(id)
					if next(stashItems) then
						secondInv.inventory = stashItems
						Stashes[id] = {}
						Stashes[id].items = stashItems
						Stashes[id].isOpen = src
						Stashes[id].label = secondInv.label
					else
						Stashes[id] = {}
						Stashes[id].items = {}
						Stashes[id].isOpen = src
						Stashes[id].label = secondInv.label
					end
				end

				if items then
					for i, v in ipairs(items) do
						local itemInfo = QBCore.Shared.Items[v.Name]
						if itemInfo then
							table.insert(secondInv.inventory, {
								useable = itemInfo["useable"],
								unique = itemInfo["unique"],
								name = itemInfo["name"],
								amount = v.Count,
								slot = i,
								image = itemInfo["image"],
								weight = itemInfo["weight"],
								type = itemInfo["type"],
								info = {
									quality = 100
								},
								label = itemInfo["label"],
								description = itemInfo["description"] or "",
							})
						else
							print("^8warning: The desired item["..v.Name.."] was not found, please register it in qb-core/shared/items.lua ^0")
						end
					end
				end
			elseif name == "trunk" then
				if Trunks[id] then
					if Trunks[id].isOpen then
						local Target = QBCore.Functions.GetPlayer(Trunks[id].isOpen)
						if Target then
							TriggerClientEvent('inventory:client:CheckOpenState', Trunks[id].isOpen, name, id, Trunks[id].label)
						else
							Trunks[id].isOpen = false
						end
					end
				end
				secondInv.name = "trunk-"..id
				secondInv.label = "Trunk-"..id
				secondInv.maxweight = other.maxweight or 60000
				secondInv.inventory = {}
				secondInv.slots = other.slots or 50
				if (Trunks[id] and Trunks[id].isOpen) or (QBCore.Shared.SplitStr(id, "PLZI")[2] and Player.PlayerData.job.name ~= "police") then
					secondInv.name = "none-inv"
					secondInv.label = "Trunk-None"
					secondInv.maxweight = other.maxweight or 60000
					secondInv.inventory = {}
					secondInv.slots = 0
				else
					if id then
						local ownedItems = GetOwnedVehicleItems(id)
						if IsVehicleOwned(id) and next(ownedItems) then
							secondInv.inventory = ownedItems
							Trunks[id] = {}
							Trunks[id].items = ownedItems
							Trunks[id].isOpen = src
							Trunks[id].label = secondInv.label
						elseif Trunks[id] and not Trunks[id].isOpen then
							secondInv.inventory = Trunks[id].items
							Trunks[id].isOpen = src
							Trunks[id].label = secondInv.label
						else
							Trunks[id] = {}
							Trunks[id].items = {}
							Trunks[id].isOpen = src
							Trunks[id].label = secondInv.label
						end
					end
				end
			elseif name == "glovebox" then
				if Gloveboxes[id] then
					if Gloveboxes[id].isOpen then
						local Target = QBCore.Functions.GetPlayer(Gloveboxes[id].isOpen)
						if Target then
							TriggerClientEvent('inventory:client:CheckOpenState', Gloveboxes[id].isOpen, name, id, Gloveboxes[id].label)
						else
							Gloveboxes[id].isOpen = false
						end
					end
				end
				secondInv.name = "glovebox-"..id
				secondInv.label = "Glovebox-"..id
				secondInv.maxweight = 10000
				secondInv.inventory = {}
				secondInv.slots = 5
				if Gloveboxes[id] and Gloveboxes[id].isOpen then
					secondInv.name = "none-inv"
					secondInv.label = "Glovebox-None"
					secondInv.maxweight = 10000
					secondInv.inventory = {}
					secondInv.slots = 0
				else
					local ownedItems = GetOwnedVehicleGloveboxItems(id)
					if Gloveboxes[id] and not Gloveboxes[id].isOpen then
						secondInv.inventory = Gloveboxes[id].items
						Gloveboxes[id].isOpen = src
						Gloveboxes[id].label = secondInv.label
					elseif IsVehicleOwned(id) and next(ownedItems) then
						secondInv.inventory = ownedItems
						Gloveboxes[id] = {}
						Gloveboxes[id].items = ownedItems
						Gloveboxes[id].isOpen = src
						Gloveboxes[id].label = secondInv.label
					else
						Gloveboxes[id] = {}
						Gloveboxes[id].items = {}
						Gloveboxes[id].isOpen = src
						Gloveboxes[id].label = secondInv.label
					end
				end
			elseif name == "shop" then
				secondInv.name = "itemshop-"..id
				secondInv.label = other.label
				secondInv.maxweight = 900000
				secondInv.inventory = SetupShopItems(other.items)
				ShopItems[id] = {}
				ShopItems[id].items = other.items
				secondInv.slots = #other.items
			elseif name == "traphouse" then
				secondInv.name = "traphouse-"..id
				secondInv.label = other.label
				secondInv.maxweight = 900000
				secondInv.inventory = other.items
				secondInv.slots = other.slots
			elseif name == "crafting" then
				secondInv.name = "crafting"
				secondInv.label = other.label
				secondInv.maxweight = 900000
				secondInv.inventory = other.items
				secondInv.slots = #other.items
			elseif name == "attachment_crafting" then
				secondInv.name = "attachment_crafting"
				secondInv.label = other.label
				secondInv.maxweight = 900000
				secondInv.inventory = other.items
				secondInv.slots = #other.items
			elseif name == "otherplayer" then
				local OtherPlayer = QBCore.Functions.GetPlayer(tonumber(id))
				if OtherPlayer then
					secondInv.name = "otherplayer-"..id
					secondInv.label = "Player-"..id
					secondInv.maxweight = Config.MaxInventoryWeight
					secondInv.inventory = OtherPlayer.PlayerData.items
					if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then
						secondInv.slots = Config.MaxInventorySlots
					else
						secondInv.slots = Config.MaxInventorySlots - 1
					end
					Wait(250)
				end
			else
				if Drops[id] then
					if Drops[id].isOpen then
						local Target = QBCore.Functions.GetPlayer(Drops[id].isOpen)
						if Target then
							TriggerClientEvent('inventory:client:CheckOpenState', Drops[id].isOpen, name, id, Drops[id].label)
						else
							Drops[id].isOpen = false
						end
					end
				end
				if Drops[id] and not Drops[id].isOpen then
					secondInv.coords = Drops[id].coords
					secondInv.name = id
					secondInv.label = "Dropped-"..tostring(id)
					secondInv.maxweight = 100000
					secondInv.inventory = Drops[id].items
					secondInv.slots = 30
					Drops[id].isOpen = src
					Drops[id].label = secondInv.label
					Drops[id].createdTime = os.time()
				else
					secondInv.name = "none-inv"
					secondInv.label = "Dropped-None"
					secondInv.maxweight = 100000
					secondInv.inventory = {}
					secondInv.slots = 0
				end
			end

			TriggerClientEvent("qb-inventory:client:closeinv", id)
			TriggerClientEvent("inventory:client:OpenInventory", src, {}, Player.PlayerData.items, secondInv)
		else
			TriggerClientEvent("inventory:client:OpenInventory", src, {}, Player.PlayerData.items)
		end
	else
		TriggerClientEvent('QBCore:Notify', src, 'Not Accessible', 'error')
	end
end)
</code></pre>

### Add Icons Item

Add icon items in **`qb-inventory/html/images`** or your <mark style="color:yellow;">**custome inventory**</mark>

### Add Items Data

Add items data in **`qb-core/shared/items.lua`** or <mark style="color:yellow;">**custome inventory**</mark>

### Replace cnofig table

Open **`FiveStar-MissionClub/shared/config.lua`**, find **`Config.CreateBag`** and replace the **`Config.CreateBag`** table.

```lua
Config.CreateBag = {
    ShowInvetory = function(_, Identifier)
        local BagID = Config.CreateBag.Data.label.. " ["..math.random(1, 999).."]"
        TriggerServerEvent('inventory:server:OpenInventory', 'stash', BagID, {
            maxweight = Config.CreateBag.Data.weight,
            slots = Config.CreateBag.Data.slots,
        }, Config.CreateBag.Items)
        TriggerEvent('inventory:client:SetCurrentStash', BagID)
    end,
    Data = {
        label = "Matteo Malleri ",
        slots = 50,
        weight = 120000
    },
    Items = { -- ? Add items to the bag here
    {
        Name = "crypto_hardware",
        Count = 1,
        customer = 2
    }, {
        Name = "diamond",
        Count = 8,
        customer = 1
    }, {
        Name = "gold",
        Count = 3,
        customer = 2
    }, {
        Name = "laptop",
        Count = 2,
        customer = 3
    }, {
        Name = "rolex",
        Count = 1,
        customer = 2
    }, {
        Name = "platinum",
        Count = 2,
        customer = 1
    }, {
        Name = "phone",
        Count = 1
    }, {
        Name = "bread",
        Count = 2
    }, {
        Name = "water",
        Count = 1
    }},
    RegisterBag = function(BagID, Identifier)
        -- No need for qb
    end,
    ReceivedTheItemsAndExitedTheGame = function(xPlayer, Cutscene) -- Cutscene --- @param [0], [1], [2], [3]
        -- ! The player is out of the game

        if Cutscene == 0 then -- If Cutscene equals 0, it means that none of the items have been delivered
            -- Remove player inventory item Mission 0/3
            -- xPlayer.Functions.ClearInventory()
        elseif Cutscene == 1 then
            -- Remove player inventory item Mission 1/3
            -- xPlayer.Functions.ClearInventory()
        elseif Cutscene == 2 then
            -- Remove player inventory item Mission 2/3
            -- xPlayer.Functions.ClearInventory()
        elseif Cutscene == 3 then
            -- Remove player inventory item Mission 3/3
            -- xPlayer.Functions.ClearInventory()
        end
    end
}

```

{% endtab %}
{% endtabs %}

### Insert SQL

Insert the **database.sql** file to your **SQL server**

### **Note**

If you use **custom inventory**, you can customize it or change it to all required scripts in config.lua.
