FiveStar Development
YoutubeCFX forumTebexDiscord
  • 👨‍💻About Us
  • 😊Control Panel ⁽ᶠᵒʳ ᶜᵘˢᵗᵒᵐᵉʳˢ ᵒᶠ ᵗʰᵉ ᵒᶠᶠᶦᶜᶦᵃˡ ˢᶦᵗᵉ⁾
    • 📲Active Redeem Code
    • ⬇️Download Script
    • 👾Create License
    • 📅Expiration date
    • ⬅️Reset Data License
  • 🧾Scripts
    • 🆘FiveStar-HelpMenu
      • 🧠How to Install
      • ⏭️Config Script
    • 🛡️FiveStar-Paintball
      • 😘[ESX]
        • 🧠How to Install
        • ⏭️Config Script
      • 🥰[QB]
        • 🧠How to Install
        • ⏭️Config Script
    • 🔫FiveStar-WeaponShop
      • 😘[ESX]
        • 🧠How to Install
        • ⏭️Config Script
      • 🥰[QB]
        • 🧠How to Install
        • ⏭️Config Script
    • 🔐FiveStar-Security [FREE FOR CUSTOMER]
      • 🧠How to Install
      • ⏭️Config Script
    • 🎟️FiveStar-MissionClub
      • 😘[ESX]
        • 🧠How to Install
        • ⏭️Config Script
      • 🥰[QB]
        • 🧠How to Install
        • ⏭️Config Script
    • 🛒FiveStar-VehicleShop
      • 😘[ESX]
        • 🧠How to Install
        • ⏭️Config Script
      • 🥰[QB]
        • 🧠How to Install
        • ⏭️Config Script
    • 💸FiveStar-Subscribe
      • 😘[ESX]
        • 🧠How to Install
        • ⏭️Config Script
      • 🥰[QB]
        • 🧠How to Install
        • ⏭️Config Script
    • 🚘FiveStar-Garage
      • 😘[ESX]
        • 🧠How to Install
        • ⏭️Config Script
      • 🥰[QB]
        • 🧠How to Install
        • ⏭️Config Script
    • 💋FiveStar-Speedometer [FREE]
      • 🧠How to Install
Powered by GitBook
On this page
  • Requirements
  • Insert SQL
  • Note
  • Add License

Was this helpful?

  1. Scripts
  2. FiveStar-MissionClub
  3. [QB]

How to Install

FiveStar Script

Previous[QB]NextConfig Script

Last updated 1 year ago

Was this helpful?

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

Add Export

Open the ox_innvetory script Find the function client.closeInventory in ox_invnetory and add the export FiveStar-MissionClub

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

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

Add Export

Open the qb-inventory script find the function client.closeInventory and Register nui call back CloseInventory in ox_invnetory and add the export FiveStar-MissionClub

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

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

Add to stash item

qb-inventory does not have the ability to add item to stash automatically, find the register net event inventory:server:OpenInventory and replace the code

RegisterNetEvent('inventory:server:OpenInventory', function(name, id, other, items)
	local src = source
	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)

Add Icons Item

Add icon items in qb-inventory/html/images or your custome inventory

Add Items Data

Add items data in qb-core/shared/items.lua or custome inventory

Replace cnofig table

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

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
}

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.

Add License

Please put your license in server/license.lua | If your script is encrypted, enter your license

🧾
🎟️
🥰
🧠
GitHub - overextended/ox_target: Standalone "third-eye" targeting resource.GitHub
GitHub - Project-Sloth/ps-inventory: Formally lj-inventory with updated UI.GitHub
Logo
GitHub - overextended/ox_inventory: Slot-based inventory with metadata.GitHub
GitHub - overextended/oxmysql: MySQL resource for FXServer.GitHub
GitHub - overextended/ox_lib: A collection of Lua functions to utilise in other resources.GitHub
Logo
Logo
Logo
Logo
Page cover image
GitHub - qbcore-framework/qb-inventory: Slot Based Inventory System Used With QB-CoreGitHub
Logo