This commit is contained in:
MrNewb committed 2025-05-19 14:15:57 -04:00
commit 00f2fbb06c
10 files changed
+109 -18

No files matched your search

+3 -3
View File
@@ -20,7 +20,7 @@ local function SpawnEntity(entityData)
local entity = nil
local coords = entityData.coords
local rotation = entityData.rotation
local rotation = entityData.rotation or vector3(0.0, 0.0, 0.0) -- Default rotation if not provided
if entityData.entityType == 'object' then
entity = CreateObject(model, coords.x, coords.y, coords.z, false, false, false)
@@ -40,7 +40,7 @@ local function SpawnEntity(entityData)
SetModelAsNoLongerNeeded(model)
SetEntityAsMissionEntity(entity, true, true) -- Keep entity from being deleted by game engine
FreezeEntityPosition(entity, true) -- Optional freeze based on meta
if entityData.OnSpawn and type(entityData.OnSpawn) == 'function' then
if entityData.OnSpawn then
entityData.OnSpawn(entityData)
end
-- print(string.format("[ClientEntity] Spawned %s entity %s (GameID: %s)", entityData.entityType, entityData.id, entity))
@@ -59,7 +59,7 @@ local function RemoveEntity(entityData)
SetEntityAsMissionEntity(entityHandle, false, false)
DeleteEntity(entityHandle)
end
if entityData.OnRemove and type(entityData.OnRemove) == 'function' then
if entityData.OnRemove then
entityData.OnRemove(entityData)
end
end
+18 -1
View File
@@ -2,6 +2,7 @@
if GetResourceState('codem-inventory') ~= 'started' then return end
Inventory = Inventory or {}
Inventory.Stashes = Inventory.Stashes or {}
local codem = exports['codem-inventory']
@@ -104,10 +105,16 @@ end
---@param groups table
---@param coords table
---@return nil
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
Inventory.OpenStash = function(src, id)
local stash = Inventory.Stashes[id]
assert(stash, "Stash not found", id)
local label = stash.label
local slots = stash.slots
local weight = stash.weight
TriggerClientEvent('community_bridge:client:codem-inventory:openStash', src, id, { label = label, slots = slots, weight = weight })
end
---This will register a stash
---@param id number||string
---@param label string
@@ -118,6 +125,16 @@ end
---@param coords table
---@return boolean
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
if Inventory.Stashes[id] then return true end
Inventory.Stashes[id] = {
id = id,
label = label,
slots = slots,
weight = weight,
owner = owner,
groups = groups,
coords = coords
}
return true
end
+15 -5
View File
@@ -2,7 +2,7 @@
if GetResourceState('core_inventory') ~= 'started' then return end
Inventory = Inventory or {}
Inventory.Stashes = Inventory.Stashes or {}
local core = exports.core_inventory
---This will add an item, and return true or false based on success
@@ -133,10 +133,10 @@ end
---@param groups table
---@param coords table
---@return nil
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
if not slots then slots = 30 end
local mathyShit = slots / 2
core:openInventory(playerid, id, 'stash', mathyShit, mathyShit, true, nil, false)
Inventory.OpenStash = function(src, id)
local stash = Inventory.Stashes[id]
assert(stash, "Stash not found", id)
core:openInventory(src, id, 'stash', stash.slots, stash.weight, true, nil, false)
end
---This will register a stash
@@ -149,8 +149,18 @@ end
---@param coords table
---@return boolean
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
if Inventory.Stashes[id] then return true end
if not slots then slots = 30 end
local mathyShit = slots / 2
Inventory.Stashes[id] = {
id = id,
label = label,
slots = mathyShit,
weight = mathyShit,
owner = owner,
groups = groups,
coords = coords
}
core:openInventory(nil, id, 'stash', mathyShit, mathyShit, false, nil, false)
return true
end
+15 -2
View File
@@ -5,6 +5,7 @@ local jpr = exports['jpr-inventory']
local registeredShops = {}
Inventory = Inventory or {}
Inventory.Stashes = Inventory.Stashes or {}
---This will add an item, and return true or false based on success
---@param src number
@@ -70,8 +71,10 @@ end
---@param groups table
---@param coords table
---@return nil
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
TriggerClientEvent('community_bridge:client:jpr-inventory:openStash', src, id, { weight = weight, slots = slots })
Inventory.OpenStash = function(src, id)
local stash = Inventory.Stashes[id]
assert(stash, "Stash not found", id)
TriggerClientEvent('community_bridge:client:jpr-inventory:openStash', src, id, { weight = stash.weight, slots = stash.slots })
end
---This will register a stash
@@ -84,6 +87,16 @@ end
---@param coords table
---@return boolean
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
if Inventory.Stashes[id] then return true end
Inventory.Stashes[id] = {
id = id,
label = label,
slots = slots,
weight = weight,
owner = owner,
groups = groups,
coords = coords
}
return true
end
+14 -1
View File
@@ -2,6 +2,7 @@
if GetResourceState('origen_inventory') ~= 'started' then return end
Inventory = Inventory or {}
Inventory.Stashes = Inventory.Stashes or {}
local origin = exports.origen_inventory
@@ -107,7 +108,9 @@ end
---@param groups table
---@param coords table
---@return nil
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
Inventory.OpenStash = function(src, id)
local stash = Inventory.Stashes[id]
assert(stash, "Stash not found", id)
return origin:OpenInventory(src, 'stash', id)
end
@@ -121,6 +124,16 @@ end
---@param coords table
---@return boolean
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
if Inventory.Stashes[id] then return true end
Inventory.Stashes[id] = {
id = id,
label = label,
slots = slots,
weight = weight,
owner = owner,
groups = groups,
coords = coords
}
return origin:registerStash(id, label, slots, weight, owner, groups, coords)
end
+15 -4
View File
@@ -5,7 +5,7 @@ local ox_inventory = exports.ox_inventory
local registeredShops = {}
Inventory = Inventory or {}
Inventory.Stashes = Inventory.Stashes or {}
---This will add an item, and return true or false based on success
---@param src number
---@param item string
@@ -94,8 +94,9 @@ end
---@param groups table
---@param coords table
---@return nil
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
TriggerClientEvent('ox_inventory:openInventory', src, 'stash', 'stash_' .. id)
Inventory.OpenStash = function(src, id)
assert(Inventory.Stashes[id], "Stash not found", id)
TriggerClientEvent('ox_inventory:openInventory', src, 'stash', id)
end
---This will register a stash
@@ -108,7 +109,17 @@ end
---@param coords table
---@return boolean
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
return ox_inventory:RegisterStash(id, label, slots, weight, owner)
if Inventory.Stashes[id] then return true end
Inventory.Stashes[id] = {
id = id,
label = label,
slots = slots,
weight = weight,
owner = owner,
groups = groups,
coords = coords
}
return ox_inventory:RegisterStash(id, label, slots, weight, owner, groups)
end
---This will return a boolean if the player has the item.
+11
View File
@@ -4,6 +4,7 @@ local sloth = exports['ps-inventory']
local registeredShops = {}
Inventory = Inventory or {}
Inventory.Stashes = Inventory.Stashes or {}
---This will add an item, and return true or false based on success
---@param src number
@@ -106,6 +107,16 @@ end
---@param coords table
---@return boolean
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
if Inventory.Stashes[id] then return true end
Inventory.Stashes[id] = {
id = id,
label = label,
slots = slots,
weight = weight,
owner = owner,
groups = groups,
coords = coords
}
return true
end
+16 -2
View File
@@ -3,6 +3,7 @@ if GetResourceState('qb-inventory') ~= 'started' then return end
local qbInventory = exports['qb-inventory']
Inventory = Inventory or {}
Inventory.Stashes = Inventory.Stashes or {}
local registeredShops = {}
local v1ShopData = {}
@@ -85,8 +86,11 @@ end
---@param groups table
---@param coords table
---@return nil
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
TriggerClientEvent('community_bridge:client:qb-inventory:openStash', src, id, { weight = weight, slots = slots })
Inventory.OpenStash = function(src, id)
local stash = Inventory.Stashes[id]
assert(stash, "Stash not found", id)
TriggerClientEvent('community_bridge:client:qb-inventory:openStash', src, id, { weight = stash.weight, slots = stash.slots})
end
---This will register a stash
@@ -99,6 +103,16 @@ end
---@param coords table
---@return boolean
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
if Inventory.Stashes[id] then return true end
Inventory.Stashes[id] = {
id = id,
label = label,
slots = slots,
weight = weight,
owner = owner,
groups = groups,
coords = coords
}
return true
end
@@ -4,6 +4,7 @@ if GetResourceState('qs-inventory') ~= 'started' then return end
local quasar = exports['qs-inventory']
Inventory = Inventory or {}
Inventory.Stashes = Inventory.Stashes or {}
---This will add an item, and return true or false based on success
---@param src number
@@ -4,6 +4,7 @@ if GetResourceState('tgiann-inventory') ~= 'started' then return end
local tgiann = exports["tgiann-inventory"]
Inventory = Inventory or {}
Inventory.Stashes = Inventory.Stashes or {}
---This will add an item, and return true or false based on success
---@param src number