local QBCore = exports['qb-core']:GetCoreObject() Config = {} Config.lockerProps = {'p_cs_locker_01_s'} -- Props you can access storage Config.Locations = { [1] = { name = 'SD', location = vector3(1827.6656, 3680.0276, 34.4050), radius = 8.0, maxweight = 30000, slots = 32.0, }, [2] = { name = 'Observ', location = vector3(-226.12, -2030.87, 27.76), radius = 10.0, maxweight = 30000, slots = 32.0, }, } Citizen.CreateThread(function() exports['qb-target']:AddTargetModel(Config.lockerProps, { options = { { id = 1, icon = "fa-solid fa-lock", label = "Open personal locker", action = function(entity) TriggerEvent('rj-lockers:openLocker', entity) end, }, }, distance = 1.5 }) end) RegisterNetEvent('rj-lockers:openLocker', function(entity) local PlayerData = QBCore.Functions.GetPlayerData() local lockerLoc = GetEntityCoords(entity) local accessGranted = false for x, v in pairs(Config.Locations) do if GetDistanceBetweenCoords(lockerLoc, v.location) < v.radius then TriggerServerEvent("inventory:server:OpenInventory", "stash", v.name .. "_" .. PlayerData.citizenid, {maxweight = v.maxweight, slots = v.slots}) TriggerEvent("inventory:client:SetCurrentStash", v.name .. "_" .. PlayerData.citizenid) accessGranted = true break end end if not accessGranted then QBCore.Functions.Notify('You cannot access this locker', 'error', 5000) end end)