Compare commits

...

11 Commits

Author SHA1 Message Date
Jim Shield
8594ba12ec Version Bump
`2.1.06` - `2.1.07`
2025-10-10 13:27:29 +01:00
Jim Shield
9f914bd497 Fix embedded store handling 2025-10-10 02:55:16 +01:00
Jim Shield
ad47836232 All grabbox to recieve slot and maxweight 2025-10-10 01:41:52 +01:00
Jim Shield
ae4637f9c4 Fix OrigenInv getPlayerInv() func calling OX_Inv 2025-10-10 00:40:35 +01:00
Jim Shield
a13284d0e0 Add support for 17mov progressbars 2025-10-09 20:12:05 +01:00
Jim Shield
98f8944a79 Add codem option for billing 2025-10-09 20:05:15 +01:00
Jim Shield
13b0f796ff createPropTarget also makes the prop 2025-10-09 20:04:54 +01:00
Jim Shield
b282d3393f make the auto check for minZ and maxZ more lenient 2025-10-09 17:55:54 +01:00
Jim Shield
180cc7b2a2 Add new createPropTarget() function
This is intended to help create automated prop based targets

Using the coordinates and specified prop models dimensions to create a correctly sized box target.

```lua
createPropTarget({
	name,
	target.prop.coords,
	target.prop.model,
}, options, 2.0)
```
2025-10-08 22:53:36 +01:00
Jim Shield
beb67b79a5 Auto adjust boxes with poorly set minZ and maxZ
Automatically adjusts box targets for custom locations that have been set wrong

if minZ is too high, adjust it
if maxZ is too low, adjust it

and warn the client that the target has to be adjusted.

Solves people opening tickets because they half edited a location without reading my docs
2025-10-07 21:07:31 +01:00
Jim Shield
c359bc4342 Support embedded shops in other scripts 2025-10-07 13:54:31 +01:00
7 changed files with 170 additions and 22 deletions

View File

@@ -1,6 +1,6 @@
name "Jim_Bridge" name "Jim_Bridge"
author "Jimathy" author "Jimathy"
version "2.1.06" version "2.1.07"
description "Framework Bridge By Jimathy" description "Framework Bridge By Jimathy"
fx_version "cerulean" fx_version "cerulean"
rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.' rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.'

View File

@@ -956,4 +956,18 @@ end
function GetEntityForwardVector(entity) function GetEntityForwardVector(entity)
local heading = math.rad(GetEntityHeading(entity) + 90) local heading = math.rad(GetEntityHeading(entity) + 90)
return vec3(math.cos(heading), math.sin(heading), 0.0) return vec3(math.cos(heading), math.sin(heading), 0.0)
end
function adjustMinMaxZ(coord, table)
local table = table
local adMinZ, adMaxZ = false, false
if table.minZ > (coord.z + 0.1) then
adMinZ = true
table.minZ = (coord.z - 1.05)
end
if table.maxZ < (coord.z - 0.1) then
adMinZ = true
table.maxZ = (coord.z + 0.80)
end
return table.minZ, table.maxZ, adMinZ, adMaxZ
end end

View File

@@ -272,15 +272,15 @@ local InvFunc = {
function(src) function(src)
local grabInv = nil local grabInv = nil
if src then if src then
grabInv = exports[OXInv]:GetInventoryItems(src) grabInv = exports[OrigenInv]:GetInventoryItems(src)
else else
grabInv = exports[OXInv]:GetPlayerItems() grabInv = exports[OrigenInv]:GetInventory()
end end
return grabInv return grabInv
end, end,
invImg = invImg =
function(item) function(item)
return "nui://"..OrigenInv.."/html/img/"..(Items[item].image or "") return "nui://"..OrigenInv.."/html/images/"..(Items[item].image or "")
end, end,
openShop = openShop =
function(name, label, items) function(name, label, items)
@@ -1377,7 +1377,6 @@ function getPlayerInv(src)
grabInv = triggerCallback(getScript()..":GetESXInv") grabInv = triggerCallback(getScript()..":GetESXInv")
end end
end end
--jsonPrint(grabInv)
end end
if grabInv == nil then if grabInv == nil then
@@ -2356,7 +2355,6 @@ function getStash(stashName)
end end
debugPrint("^6Bridge^7: ^3GetStashItems^7: ^2Stash information for '^6"..stashName.."^7' retrieved") debugPrint("^6Bridge^7: ^3GetStashItems^7: ^2Stash information for '^6"..stashName.."^7' retrieved")
end end
--jsonPrint(items)
return items return items
end end
@@ -2548,7 +2546,7 @@ if isServer() then
end) end)
end end
RegisterNetEvent(getScript()..":openGrabBox", function(data) RegisterNetEvent(getScript()..":openGrabBox", function(data, stashData)
local Ped = PlayerPedId() local Ped = PlayerPedId()
local id = data.metadata and data.metadata.id or data.info and data.info.id or "" local id = data.metadata and data.metadata.id or data.info and data.info.id or ""
@@ -2559,7 +2557,9 @@ RegisterNetEvent(getScript()..":openGrabBox", function(data)
openStash({ openStash({
stash = id, stash = id,
coords = GetEntityCoords(Ped) coords = GetEntityCoords(Ped),
maxWeight = stashData and stashData.maxWeight or 100000,
slots = stashData and stashData.slots or 5,
}) })
end) end)
@@ -2781,7 +2781,6 @@ end
--- }) --- })
--- ``` --- ```
function openShop(data) function openShop(data)
--jsonPrint(data)
if (data.job or data.gang) and not jobCheck(data.job or data.gang) then return end if (data.job or data.gang) and not jobCheck(data.job or data.gang) then return end
-- If shop has registered coords, limit players from being too far away from it when opening -- If shop has registered coords, limit players from being too far away from it when opening
@@ -2790,6 +2789,7 @@ function openShop(data)
print("^3Warning^7: ^2This isn't a registered store^1, refusing call^7") print("^3Warning^7: ^2This isn't a registered store^1, refusing call^7")
return return
end end
if not distExploitCheck(exploitCheck) then if not distExploitCheck(exploitCheck) then
return return
end end
@@ -2799,6 +2799,27 @@ function openShop(data)
lookEnt(data.coords) lookEnt(data.coords)
return return
end end
if not data.items.items[1] then
local shopMenu = {}
for k, v in pairs(data.items.items) do
local clonedTable = cloneTable(data)
local itemsTable = v.items or v.Items
shopMenu[#shopMenu+1] = {
header = v.header or k,
txt = countTable(itemsTable).." Products",
onSelect = function()
--clonedTable.originShop = data.shop
clonedTable.shop = data.shop.."_"..k
clonedTable.label = data.items.label.." - "..(v.header or k)
clonedTable.slots = #itemsTable
clonedTable.items.items = itemsTable
openShop(clonedTable)
end,
}
end
return openMenu(shopMenu, { header = data.items.label, canClose = true, })
end
for i = 1, #InvFunc do for i = 1, #InvFunc do
local inv = InvFunc[i] local inv = InvFunc[i]
@@ -2823,7 +2844,7 @@ RegisterNetEvent(getScript()..':server:openServerShop', function(shopName)
-- If shop has registered coords, limit players from being too far away from it when opening -- If shop has registered coords, limit players from being too far away from it when opening
if not shopExploitCheck[shopName] then if not shopExploitCheck[shopName] then
print("^3Warning^7: ^1Source^7: ^3"..src.." ^1Tried to open a shop^7: ^2This isn't a registered store^1, refusing call^7") print("^3Warning^7: ^1Source^7: ^3"..src.." ^1Tried to open a shop ^7'"..shopName.."' ^2This isn't a registered store^7, ^1refusing call^7")
return return
end end
if not distExploitCheck(shopExploitCheck[shopName], src) then if not distExploitCheck(shopExploitCheck[shopName], src) then
@@ -2865,8 +2886,18 @@ function registerShop(name, label, items, society, coords)
for i = 1, #InvFunc do for i = 1, #InvFunc do
local inv = InvFunc[i] local inv = InvFunc[i]
if isStarted(inv.invName) then if isStarted(inv.invName) then
inv.registerShop(name, label, items, society) if not items[1] then
debugPrint("^6Bridge^7: ^2Registering ^5"..inv.invName.." ^3Store^7:", name, "^4Label^7: "..label, coords and "- ^4Coord^7: "..formatCoord(coords) or "NO COORD SET") for k, v in pairs(items) do
inv.registerShop(name.."_"..k, label.." - "..(v.header or k), v.items, society)
shopExploitCheck[name.."_"..k] = shopExploitCheck[name.."_"..k] or {}
shopExploitCheck[name.."_"..k][#shopExploitCheck[name.."_"..k]+1] = coords
debugPrint("^6Bridge^7: ^2Registering ^5"..inv.invName.." ^3Store^7:", name.."_"..k, "^4Label^7: "..label.." - "..(v.header or k), coords and "- ^4Coord^7: "..formatCoord(coords) or "NO COORD SET")
end
else
inv.registerShop(name, label, items, society)
debugPrint("^6Bridge^7: ^2Registering ^5"..inv.invName.." ^3Store^7:", name, "^4Label^7: "..label, coords and "- ^4Coord^7: "..formatCoord(coords) or "NO COORD SET")
end
break break
end end
end end

View File

@@ -206,6 +206,52 @@ local progressFunc = {
exports.jim_bridge:stopProgressBar() exports.jim_bridge:stopProgressBar()
end, end,
}, },
["17mov"] = {
start =
function(data)
if exports["17mov_Hud"]:StartProgress({
duration = debugMode and 1000 or data.time,
label = data.label,
useWhileDead = data.dead or false,
canCancel = data.cancel or true,
controlDisables = {
disableMovement = data.disableMovement or false,
disableCarMovement = data.disableMovement or false,
disableMouse = data.mouse or false,
disableCombat = data.combat or true,
},
animation = {
animDict = data.dict,
anim = data.anim,
flags = (data.flag == 8 and 32 or data.flag) or nil,
task = data.task,
},
prop = data.prop and {
model = data.prop.model,
bone = data.prop.bone or 0,
coords = data.prop.pos or vec3(0, 0, 0),
rotation = data.prop.rot or vec3(0, 0, 0),
} or nil,
propTwo = data.propTwo and {
model = data.propTwo.model,
bone = data.propTwo.bone or 0,
coords = data.propTwo.pos or vec3(0, 0, 0),
rotation = data.propTwo.rot or vec3(0, 0, 0),
} or nil,
}, nil, nil) then
return true
else
return false
end
end,
stop =
function()
exports["17mov_Hud"]:StopProgress()
end,
},
} }
--- Displays a progress bar using the configured progress bar system. --- Displays a progress bar using the configured progress bar system.

View File

@@ -217,6 +217,10 @@ local billPlayerFunc = {
function(data) function(data)
TriggerEvent("okokBilling:ToggleCreateInvoice") TriggerEvent("okokBilling:ToggleCreateInvoice")
end, end,
codem =
function(data)
TriggerEvent("codem-billing:client:OpenMenu")
end,
} }
--- BillPlayer --- BillPlayer

View File

@@ -252,7 +252,7 @@ function createEntityTarget(entity, opts, dist)
-- Store the target entity for later cleanup. -- Store the target entity for later cleanup.
targetEntities[#targetEntities + 1] = entity targetEntities[#targetEntities + 1] = entity
-- if force target off, use jim_bridge buiilt in target functions -- if force target off, use jim_bridge built in target functions
if Config.System.DontUseTarget then if Config.System.DontUseTarget then
exports.jim_bridge:createEntityTarget(entity, opts, dist) exports.jim_bridge:createEntityTarget(entity, opts, dist)
debugPrint("^6Bridge^7: ^2Creating new ^3Entity ^2target with ^6jim_bridge ^2for entity ^7"..entity) debugPrint("^6Bridge^7: ^2Creating new ^3Entity ^2target with ^6jim_bridge ^2for entity ^7"..entity)
@@ -324,8 +324,7 @@ end
---}, 2.0) ---}, 2.0)
---``` ---```
function createBoxTarget(data, opts, dist) function createBoxTarget(data, opts, dist)
-- if force target off, use jim_bridge built in target functions
-- if force target off, use jim_bridge buiilt in target functions
if Config.System.DontUseTarget then if Config.System.DontUseTarget then
debugPrint("^6Bridge^7: ^2Creating new ^3Box ^2target with ^6jim_bridge ^7"..data[1]) debugPrint("^6Bridge^7: ^2Creating new ^3Box ^2target with ^6jim_bridge ^7"..data[1])
return exports.jim_bridge:createZoneTarget(data, opts, dist) return exports.jim_bridge:createZoneTarget(data, opts, dist)
@@ -336,6 +335,13 @@ function createBoxTarget(data, opts, dist)
local script = targetFunc[i] local script = targetFunc[i]
if isStarted(script.targetName) then if isStarted(script.targetName) then
debugPrint("^6Bridge^7: ^2Creating new ^3Box ^2target with ^6"..script.targetName.." ^7"..data[1]) debugPrint("^6Bridge^7: ^2Creating new ^3Box ^2target with ^6"..script.targetName.." ^7"..data[1])
if data[5].minZ or data[5].maxZ then
local adMinZ, adMaxZ
data[5].minZ, data[5].maxZ, adMinZ, adMaxZ = adjustMinMaxZ(data[2], { minZ = data[5].minZ, maxZ = data[5].maxZ })
if adMinZ or adMaxZ then
print("^5Debug^7: ^2Auto adjusted ^7'^4"..data[1].."^7' ^2minZ and maxZ because ^1they weren't set correctly ^2remove or fix them for this target")
end
end
local target = script.boxTarget(data, opts, dist) local target = script.boxTarget(data, opts, dist)
boxTargets[#boxTargets + 1] = target boxTargets[#boxTargets + 1] = target
return target return target
@@ -344,6 +350,50 @@ function createBoxTarget(data, opts, dist)
return nil return nil
end end
function createPropTarget(data, opts, dist)
-- Audo create a location based on a coord and a prop models dimensions
local width, depth, _ = GetPropDimensions(data[3])
local min, max = GetModelDimensions(data[3])
local coordAdjustment = data[2] - vec4(0, 0, 1.03, 0)
local newData = {
[1] = data[1],
[2] = coordAdjustment.xyz,
[3] = width + 0.1,
[4] = depth + 0.1,
[5] = {
name = data[1],
heading = coordAdjustment.w - 90.0,
debugPoly = debugMode,
minZ = coordAdjustment.z + (min.z) - 0.1,
maxZ = coordAdjustment.z + (max.z) + 0.1,
}
}
if data[3] then -- If spawning a prop, make entity target instead (ignores depth and width stuff)
makeDistProp({ prop = data[3], coords = data[2] }, true, false)
end
-- if force target off, use jim_bridge built in target functions
if Config.System.DontUseTarget then
debugPrint("^6Bridge^7: ^2Creating new ^3Box ^2target with ^6jim_bridge ^7"..data[1])
return exports.jim_bridge:createZoneTarget(newData, opts, dist)
end
-- Check for target script and use that
for i = 1, #targetFunc do
local script = targetFunc[i]
if isStarted(script.targetName) then
debugPrint("^6Bridge^7: ^2Creating new ^3Box ^2target with ^6"..script.targetName.." ^7"..data[1])
local target = script.boxTarget(newData, opts, dist)
boxTargets[#boxTargets + 1] = target
return target
end
end
return nil
end
------------------------------------------------------------- -------------------------------------------------------------
-- Circle Zone Target Creation -- Circle Zone Target Creation
------------------------------------------------------------- -------------------------------------------------------------
@@ -382,7 +432,7 @@ end
--- ``` --- ```
function createCircleTarget(data, opts, dist) function createCircleTarget(data, opts, dist)
-- if force target off, use jim_bridge buiilt in target functions -- if force target off, use jim_bridge built in target functions
if Config.System.DontUseTarget then if Config.System.DontUseTarget then
debugPrint("^6Bridge^7: ^2Creating new ^3Sphere ^2target with ^6jim_bridge ^7"..data[1]) debugPrint("^6Bridge^7: ^2Creating new ^3Sphere ^2target with ^6jim_bridge ^7"..data[1])
return exports.jim_bridge:createZoneTarget(data, opts, dist) return exports.jim_bridge:createZoneTarget(data, opts, dist)
@@ -429,7 +479,7 @@ end
---``` ---```
function createModelTarget(models, opts, dist) function createModelTarget(models, opts, dist)
-- if force target off, use jim_bridge buiilt in target functions -- if force target off, use jim_bridge built in target functions
if Config.System.DontUseTarget then if Config.System.DontUseTarget then
debugPrint("^6Bridge^7: ^2Creating new ^3Model ^2target with ^6jim_bridge^7") debugPrint("^6Bridge^7: ^2Creating new ^3Model ^2target with ^6jim_bridge^7")
return exports.jim_bridge:createModelTarget(models, opts, dist) return exports.jim_bridge:createModelTarget(models, opts, dist)

View File

@@ -1,8 +1,11 @@
2.1.06 2.1.07
- Fix stress calculations adding instead of taking away - Support for new embeded shop recipes
- Add basic support for fallback functions for inventory management (esx isn't very well supported currently) - Add checks for targets set with minZ and maxZ set too high or low
- Create ui_modules/alcohol.lua to handle alcohol and drug effects between scripts - New target function `createPropTarget()` which creates a box target based on a prop model
- Fix AnimSet loading for "AlienEffect()" - Add CodeM as option for billing
- Add 17Mov progressbar support
- Fix OrigenInv calling OX_Inv to get player inventory
- Allow "Grab Boxes" to have custom slots and weight
https://github.com/jimathy/jim_bridge/releases/latest https://github.com/jimathy/jim_bridge/releases/latest