Compare commits

...

9 Commits

Author SHA1 Message Date
Jim Shield
f9b97b7505 Version bump 2.0.05 2025-05-04 16:24:55 +01:00
Jim Shield
489da64c5e add a new warning for token auth 2025-05-04 15:40:20 +01:00
Jim Shield
07c35cd917 workaround for ox_inventory returning a bool
I think, if ox_inventory checks a stash that doesn't exist yet, it returns a boolean or `nil`

This checks for that and instead returns a table to hopefully stop the scripts from breaking
2025-05-04 15:21:02 +01:00
Jim Shield
3f72a21d75 Update bigMessageInstance.lua 2025-05-03 20:28:13 +01:00
Jim Shield
4ad6170a49 Fix ox_target items variable
Completely overlooked that ox_target item variable is `items` not `item`

changes
```lua
                item = opts[i].item or nil,
```
to:
```lua
                items = opts[i].item or nil,
```
2025-05-03 00:11:28 +01:00
Jim Shield
18df0817b1 Make version checks a bit more obvious
Adds more obvious prints if the current version is outdated

(and also repeats it every 20 minutes)
2025-05-02 22:22:47 +01:00
Jim Shield
0eca7ae29e Fix CodeM item slot check for metadata function
The slot data for CodeM apparently returns as a string, this fixes it trying to compare a string to a number

```lua
            if v.name == item and v.slot <= lowestSlot then
```
to
```lua
            if v.name == item and tonumber(v.slot) <= lowestSlot then
```
2025-05-02 22:20:26 +01:00
Jim Shield
6a5913230f Add better fallbacks for if no metadata table is found
```lua
                durability = v.info.durability
```
to:
```lua
                durability = v.info and v.info.durability or nil
```
2025-05-02 22:16:51 +01:00
Jim Shield
b7a284e051 Fix new duty sync
This should have been placed in a `onPlayerLoaded()` but it was checking at script start for player info before that info was able to be grabbed
2025-05-02 12:29:02 +01:00
11 changed files with 50 additions and 21 deletions

View File

@@ -35,7 +35,14 @@ function CheckBridgeVersion()
if compareResult == 0 then if compareResult == 0 then
print("^7'^3jim_bridge^7' - ^2You are running the latest version^7. ^7(^3"..currentVersionRaw.."^7)") print("^7'^3jim_bridge^7' - ^2You are running the latest version^7. ^7(^3"..currentVersionRaw.."^7)")
elseif compareResult < 0 then elseif compareResult < 0 then
-- Made the check a bit more obvious
print("^1----------------------------------------------------------------------^7")
print("^7'^3jim_bridge^7' - ^1You are running an outdated version^7! ^7(^3"..currentVersionRaw.."^7 → ^3"..newestVersionRaw.."^7)") print("^7'^3jim_bridge^7' - ^1You are running an outdated version^7! ^7(^3"..currentVersionRaw.."^7 → ^3"..newestVersionRaw.."^7)")
print("^1----------------------------------------------------------------------^7")
SetTimeout(1200000, function()
-- Do a naughty repeat message every 20 minutes until the the script is updated
CheckBridgeVersion()
end)
else else
print("^7'^3jim_bridge^7' - ^5You are running a newer version ^7(^3"..currentVersionRaw.."^7 ← ^3"..newestVersionRaw.."^7)") print("^7'^3jim_bridge^7' - ^5You are running a newer version ^7(^3"..currentVersionRaw.."^7 ← ^3"..newestVersionRaw.."^7)")
end end

View File

@@ -1,6 +1,6 @@
name "Jim_Bridge" name "Jim_Bridge"
author "Jimathy" author "Jimathy"
version "2.0.04" version "2.0.05"
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

@@ -51,7 +51,13 @@ function CheckVersion()
if compareResult == 0 then if compareResult == 0 then
print("^7'^3"..script.."^7' - ^2You are running the latest version^7. (^3"..currentVersionRaw.."^7)") print("^7'^3"..script.."^7' - ^2You are running the latest version^7. (^3"..currentVersionRaw.."^7)")
elseif compareResult < 0 then elseif compareResult < 0 then
print("^1----------------------------------------------------------------------^7")
print("^7'^3"..script.."^7' - ^1You are currently running an outdated version^7! (^3"..currentVersionRaw.."^7 → ^3"..fallbackVersionRaw.."^7)") print("^7'^3"..script.."^7' - ^1You are currently running an outdated version^7! (^3"..currentVersionRaw.."^7 → ^3"..fallbackVersionRaw.."^7)")
print("^1----------------------------------------------------------------------^7")
SetTimeout(1200000, function()
-- Do a naughty repeat message every 20 minutes until the the script is updated
CheckVersion()
end)
else else
print("^7'^3"..script.."^7' - ^5You are running a newer version ^7(^3"..currentVersionRaw.."^7 ← ^3"..fallbackVersionRaw.."^7)") print("^7'^3"..script.."^7' - ^5You are running a newer version ^7(^3"..currentVersionRaw.."^7 ← ^3"..fallbackVersionRaw.."^7)")
end end
@@ -63,7 +69,13 @@ function CheckVersion()
if compareResult == 0 then if compareResult == 0 then
print("^7'^3"..script.."^7' - ^2You are running the latest version^7. (^3"..currentVersionRaw.."^7)") print("^7'^3"..script.."^7' - ^2You are running the latest version^7. (^3"..currentVersionRaw.."^7)")
elseif compareResult < 0 then elseif compareResult < 0 then
print("^1----------------------------------------------------------------------^7")
print("^7'^3"..script.."^7' - ^1You are currently running an outdated version^7! (^3"..currentVersionRaw.."^7 → ^3"..newestVersionRaw.."^7)") print("^7'^3"..script.."^7' - ^1You are currently running an outdated version^7! (^3"..currentVersionRaw.."^7 → ^3"..newestVersionRaw.."^7)")
print("^1----------------------------------------------------------------------^7")
SetTimeout(1200000, function()
-- Do a naughty repeat message every 20 minutes until the the script is updated
CheckVersion()
end)
else else
print("^7'^3"..script.."^7' - ^5You are running a newer version ^7(^3"..currentVersionRaw.."^7 ← ^3"..newestVersionRaw.."^7)") print("^7'^3"..script.."^7' - ^5You are running a newer version ^7(^3"..currentVersionRaw.."^7 ← ^3"..newestVersionRaw.."^7)")
end end

View File

@@ -433,7 +433,7 @@ function getDurability(item)
if v.name == item then if v.name == item then
if v.slot <= lowestSlot then if v.slot <= lowestSlot then
lowestSlot = v.slot lowestSlot = v.slot
durability = itemcheck[k].info.durability durability = itemcheck[k].info and itemcheck[k].info.durability or nil
end end
end end
end end
@@ -445,7 +445,7 @@ function getDurability(item)
if v.slot <= lowestSlot then if v.slot <= lowestSlot then
debugPrint(v.slot, itemcheck[k].metadata.durability) debugPrint(v.slot, itemcheck[k].metadata.durability)
lowestSlot = v.slot lowestSlot = v.slot
durability = v.metadata.durability durability = v.metadata and v.metadata.durability or nil
end end
end end
end end
@@ -455,7 +455,7 @@ function getDurability(item)
for _, v in pairs(itemcheck) do for _, v in pairs(itemcheck) do
if v.name == item and v.slot <= lowestSlot then if v.name == item and v.slot <= lowestSlot then
lowestSlot = v.slot lowestSlot = v.slot
durability = v.info.durability durability = v.info and v.info.durability or nil
end end
end end
end end
@@ -465,7 +465,7 @@ function getDurability(item)
for _, v in pairs(itemcheck) do for _, v in pairs(itemcheck) do
if v.name == item and v.slot <= lowestSlot then if v.name == item and v.slot <= lowestSlot then
lowestSlot = v.slot lowestSlot = v.slot
durability = v.metadata.durability durability = v.metadata and v.metadata.durability or nil
end end
end end
end end
@@ -473,9 +473,9 @@ function getDurability(item)
if isStarted(CodeMInv) then if isStarted(CodeMInv) then
local itemcheck = exports[CodeMInv]:GetClientPlayerInventory() local itemcheck = exports[CodeMInv]:GetClientPlayerInventory()
for _, v in pairs(itemcheck) do for _, v in pairs(itemcheck) do
if v.name == item and v.slot <= lowestSlot then if v.name == item and tonumber(v.slot) <= lowestSlot then
lowestSlot = v.slot lowestSlot = tonumber(v.slot)
durability = v.info.durability durability = v.info and v.info.durability or nil
end end
end end
end end
@@ -485,7 +485,7 @@ function getDurability(item)
for _, v in pairs(itemcheck) do for _, v in pairs(itemcheck) do
if v.name == item and v.slot <= lowestSlot then if v.name == item and v.slot <= lowestSlot then
lowestSlot = v.slot lowestSlot = v.slot
durability = v.metadata.durability durability = v.metadata and v.metadata.durability or nil
end end
end end
end end
@@ -495,7 +495,7 @@ function getDurability(item)
for _, v in pairs(itemcheck) do for _, v in pairs(itemcheck) do
if v.name == item and v.slot <= lowestSlot then if v.name == item and v.slot <= lowestSlot then
lowestSlot = v.slot lowestSlot = v.slot
durability = v.metadata.durability durability = v.metadata and v.metadata.durability or nil
end end
end end
end end

View File

@@ -14,7 +14,13 @@
------------------------------------------------------------- -------------------------------------------------------------
-- This attempts to sync up with the players framework onDuty variable -- This attempts to sync up with the players framework onDuty variable
-- This stops the script getting confused when one is false and one is true -- This stops the script getting confused when one is false and one is true
onDuty = not isServer() and getPlayer().onDuty or false onDuty = false
if not isServer() then
onPlayerLoaded(function()
onDuty = getPlayer().onDuty
end, true)
end
------------------------------------------------------------- -------------------------------------------------------------
-- Boss Role Detection -- Boss Role Detection

View File

@@ -149,8 +149,8 @@ function BigMessage:ShowColoredShard(msg, desc, textColor, bgColor, duration, ma
BeginScaleformMovieMethod(self.scaleform, "SHOW_SHARD_CENTERED_MP_MESSAGE") BeginScaleformMovieMethod(self.scaleform, "SHOW_SHARD_CENTERED_MP_MESSAGE")
ScaleformMovieMethodAddParamPlayerNameString(msg) ScaleformMovieMethodAddParamPlayerNameString(msg)
ScaleformMovieMethodAddParamPlayerNameString(desc) ScaleformMovieMethodAddParamPlayerNameString(desc)
ScaleformMovieMethodAddParamInt(bgColor)
ScaleformMovieMethodAddParamInt(textColor) ScaleformMovieMethodAddParamInt(textColor)
ScaleformMovieMethodAddParamInt(bgColor)
EndScaleformMovieMethod() EndScaleformMovieMethod()
self.duration = duration self.duration = duration

View File

@@ -157,7 +157,7 @@ function openShop(data)
elseif isStarted(OXInv) then elseif isStarted(OXInv) then
exports[OXInv]:openInventory('shop', { type = data.shop }) exports[OXInv]:openInventory('shop', { type = data.shop })
elseif isStarted(QSInv) then elseif isStarted(QSInv) or isStarted(CodeMInv) then
TriggerServerEvent("inventory:server:OpenInventory", "shop", data.items.label, data.items) TriggerServerEvent("inventory:server:OpenInventory", "shop", data.items.label, data.items)
elseif isStarted(TgiannInv) then elseif isStarted(TgiannInv) then

View File

@@ -227,7 +227,9 @@ function getStash(stashName)
local stashItems, items = {}, {} local stashItems, items = {}, {}
if isStarted(OXInv) then if isStarted(OXInv) then
stashResource = OXInv stashResource = OXInv
stashItems = exports[OXInv]:Inventory(stashName).items local stash = exports[OXInv]:Inventory(stashName)
-- Add fallback if ox can't find the stash and returns a boolean
stashItems = type(stash) == "table" and stash.items or {}
elseif isStarted(QSInv) then elseif isStarted(QSInv) then
stashResource = QSInv stashResource = QSInv

View File

@@ -121,7 +121,7 @@ function createEntityTarget(entity, opts, dist)
options[i] = { options[i] = {
icon = opts[i].icon, icon = opts[i].icon,
label = opts[i].label, label = opts[i].label,
item = opts[i].item or nil, items = opts[i].item or nil,
groups = opts[i].job or opts[i].gang, groups = opts[i].job or opts[i].gang,
onSelect = opts[i].action, onSelect = opts[i].action,
distance = dist, distance = dist,
@@ -230,7 +230,7 @@ function createBoxTarget(data, opts, dist)
options[i] = { options[i] = {
icon = opts[i].icon, icon = opts[i].icon,
label = opts[i].label, label = opts[i].label,
item = opts[i].item or nil, items = opts[i].item or nil,
groups = opts[i].job or opts[i].gang, groups = opts[i].job or opts[i].gang,
onSelect = opts[i].onSelect or opts[i].action, onSelect = opts[i].onSelect or opts[i].action,
distance = dist, distance = dist,
@@ -336,7 +336,7 @@ function createCircleTarget(data, opts, dist)
options[i] = { options[i] = {
icon = opts[i].icon, icon = opts[i].icon,
label = opts[i].label, label = opts[i].label,
item = opts[i].item or nil, items = opts[i].item or nil,
groups = opts[i].job or opts[i].gang, groups = opts[i].job or opts[i].gang,
onSelect = opts[i].onSelect or opts[i].action, onSelect = opts[i].onSelect or opts[i].action,
distance = dist, distance = dist,
@@ -418,7 +418,7 @@ function createModelTarget(models, opts, dist)
options[i] = { options[i] = {
icon = opts[i].icon, icon = opts[i].icon,
label = opts[i].label, label = opts[i].label,
item = opts[i].item or nil, items = opts[i].item or nil,
groups = opts[i].job or opts[i].gang, groups = opts[i].job or opts[i].gang,
onSelect = opts[i].action, onSelect = opts[i].action,
distance = dist, distance = dist,

View File

@@ -100,13 +100,15 @@ if isServer() then
--- @param coords table|nil (Optional) Stash coordinates. --- @param coords table|nil (Optional) Stash coordinates.
--- @usage --- @usage
--- ```lua --- ```lua
--- TriggerEvent(getScript()..":server:makeOXStash", name, label, slots, weight, owner, coords) --- TriggerEvent(getScript()..":server:makeOXStash", name, label, slots, weight, owner, coords, token)
--- ``` --- ```
RegisterNetEvent(getScript()..":server:makeOXStash", function(name, label, slots, weight, owner, coords, token) RegisterNetEvent(getScript()..":server:makeOXStash", function(name, label, slots, weight, owner, coords, token)
local src = source or nil local src = source or nil
if src then if src then
debugPrint("^1Auth^7: ^2Auth token received^7, ^2checking against server cache^7..") debugPrint("^1Auth^7: ^2Auth token received^7, ^2checking against server cache^7..")
if token ~= validTokens[src] then if token == nil then
debugPrint("^1Auth^7: ^1Token not received^7")
elseif token ~= validTokens[src] then
debugPrint("^1Auth^7: ^1Tokens don't match! ^7", token, validTokens[src]) debugPrint("^1Auth^7: ^1Tokens don't match! ^7", token, validTokens[src])
else else
debugPrint("^1Auth^7: ^2Client and Server Auth tokens match^7!", token, validTokens[src]) debugPrint("^1Auth^7: ^2Client and Server Auth tokens match^7!", token, validTokens[src])

View File

@@ -1 +1 @@
2.0.04 2.0.05