forked from Simnation/Main
locker
This commit is contained in:
parent
6f79d41d23
commit
6b5511ae5a
2 changed files with 69 additions and 0 deletions
59
resources/[inventory]/rj-lockers/client.lua
Normal file
59
resources/[inventory]/rj-lockers/client.lua
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
local QBCore = exports['qb-core']:GetCoreObject()
|
||||||
|
|
||||||
|
Config = {}
|
||||||
|
Config.lockerProps = {'p_cs_locker_01_s'} -- Props you can access storage
|
||||||
|
Config.Locations = {
|
||||||
|
[1] = {
|
||||||
|
name = 'MezeBank',
|
||||||
|
location = vector3(-203.46, -2046.54, 27.62),
|
||||||
|
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)
|
10
resources/[inventory]/rj-lockers/fxmanifest.lua
Normal file
10
resources/[inventory]/rj-lockers/fxmanifest.lua
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
fx_version 'cerulean'
|
||||||
|
game 'gta5'
|
||||||
|
|
||||||
|
author 'RJ-Scripts'
|
||||||
|
description 'rj-lockers for QBCore'
|
||||||
|
version '1.0.0'
|
||||||
|
|
||||||
|
client_script {
|
||||||
|
'client.lua',
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue