client.lua
local currentStorage = {}
function OpenStorageUnit(storageId, maxWeight, maxSlots, title)
PlaySoundFrontend(-1, "BACK", "HUD_AMMO_SHOP_SOUNDSET", false)
local str = storageId:gsub("%s+", ""):gsub('[%p%c%s]', '')
maxWeight = maxWeight or Config.Storages.maxWeight
maxSlots = maxSlots or Config.Storages.maxSlots
currentStorage = {
name = str,
weight = maxWeight * 1000,
slots = maxSlots
}
exports.ox_inventory:openInventory('stash', {
id = str,
maxWeight = maxWeight * 1000,
slots = maxSlots,
label = title or 'Lagring'
})
end
RegisterNetEvent('ox_inventory:closeInventory', function()
currentStorage = {}
end)
exports('OpenStorageUnit', OpenStorageUnit)
exports('GetCurrentStorage', function() return currentStorage end)
config.lua
Config = {}
string.startsWith = function(str, start)
return str:sub(1, #start) == start
end
Config.Storages = {
maxWeight = 200.0,
maxSlots = 50
}
fxmanifest
fx_version 'cerulean'
game 'gta5'
description 'Storage'
lua54 'yes'
shared_scripts {
'@ox_lib/init.lua',
'config.lua'
}
client_scripts {
'client/main.lua'
}
server_scripts {
'@oxmysql/lib/MySQL.lua',
'server/main.lua'
}
exports {
'OpenStorageUnit',
'GetCurrentStorage'
}
gör en server.lua