inside-scripts
Store
  • INFORMATION
    • inside-scripts
  • PAID SCRIPTS
    • 🔑 Vehicle Keys
      • Functions
      • Config
    • 🚗 Garage
      • Functions
      • Script Functionality Overview
      • Config
    • 🥦 Weed Laboratory
      • Config
    • 💊 Sell Drugs
      • Script Functionality Overview
      • Config
    • 🗯️ Dialog V1
      • Functions
      • Config
    • 🗯️ Dialog V2
      • Functions
      • Config
    • 📰 Interaction
      • Functions
      • Config
    • 🪧Notifications and Progress
      • Functions
      • Config
    • 🪛 Lock Picking
      • Config
  • FREE SCRIPTS
    • 🖥️ Bridge & Library
      • Compatibility
      • Usage & Installation
      • Functions
        • Bridge
          • Framework
            • Client
            • Server
          • Inventory
            • Server
          • Fuel
            • Client
          • Keys
            • Client
            • Server
          • Notification
            • Client
            • Server
          • Progress Bar
            • Client
          • Target
            • Client
        • Library
          • Callback
            • Client
            • Server
          • Entity
            • Client
            • Server
          • Blip
            • Client
          • Identifier
            • Server
          • Timezone
            • Server
          • Webhook
            • Server
          • Utility
            • Shared
Powered by GitBook
On this page
  1. PAID SCRIPTS
  2. 🪛 Lock Picking

Config

You can check out default config

config = {}

config.keyToAccept = 'e' -- which key confirms lock picking

config.inventoryType = 'Configure' -- qbcore, esx, oxinventory

-- A function that checks the possession of an item and the taking of an item / Server side
config.doesPlayerHaveItem = function(source, itemName, amount)
    if config.inventoryType == 'esx' then
		
        while ESX == nil do
	    ESX = exports['es_extended']:getSharedObject()
	    Wait(5)
	end
	
	local xPlayer = ESX.GetPlayerFromId(source)
	local itemCount = xPlayer.getInventoryItem(itemName).count
	if itemCount ~= nil and itemCount >= amount then
	    xPlayer.removeInventoryItem(itemName, amount)
	
	    return true
	end
	
	return false

    elseif config.inventoryType == 'qbcore' then

	while QBCore == nil do
	    QBCore = exports['qb-core']:GetCoreObject()
	    Wait(5)
	end
	
	local player = QBCore.Functions.GetPlayer(source)
	local totalAmount = 0
	for _, item in ipairs(player.Functions.GetItemsByName(itemName)) do
	    totalAmount = totalAmount + item.amount
	end
	
	if totalAmount >= amount then
	    player.Functions.RemoveItem(itemName, amount)
	
	    return true
	end
	
	return false

    elseif config.inventoryType == 'oxinventory' then
		
	if exports.ox_inventory:GetItemCount(source, itemName) >= amount then
	    exports.ox_inventory:RemoveItem(source, itemName, amount)
	
	    return true
	end
	
	return false
	
    else
	print("Configure your inventoryType correctly in config.lua.")
	return false
    end
end

Last updated 1 year ago