I completely overlooked the fact that when ox_inv shows weapon info, it does it with the upper case version `WEAPON_PISTOL` while my scripts were looking for `weapon_pistol`
making my scripts think they didn't exist
This fixes that
I've moved the framework caching to a new file `frameworkCache.lua`
This now caches the framework data once when `jim_bridge` starts
Then in `coreloader.lua` now, the information that is cached is now called from that script
This also includes better handling of ESX cached data and should stop errors
This greatly optimizes the loading of all my scripts and lowers server load to speed up server start times
I have been testing this for just under a week and 6 different test servers and it appears to work fine
I've separated the built-in custom native GTA Notifications, skillcheck and draw text targets to separate files to be loaded along side `jim_bridge`
This now makes it so they only load once instead of with every single script, and each one can call on it
This change also makes these systems able to be called outside of `jim_bridge`
For example in my test server I'm currently using:
```lua
function QBCore.Functions.Notify(text, texttype, length, icon)
CreateThread(function()
exports.jim_bridge:Notify(nil, text, icon)
end)
end
```
This should fix issues for crafting complaining inventories are open when they aren't
I was trying to use per inventory checks for them being open until I realised I could just use `IsNuiFocused()` for all inventories to check if there was an nui on the screen that used the mouse, this should be a good workaround for it
This appeared to only happen with `jim-mechanic` repair from stash, due to the stashitem's table not being sent to the function
Making it save an empty table to the database
But this was possible in other places too
I've added fallbacks for if it didn't receive a table, grab a fresh one from cache/database
This function was created to help create random numbers
When you create a table of items with a random hunger value for example
`hunger = math.random(10, 20)` this will be set at script start and never change
using `hunger = {10, 20}` and then calling this function will make it generate a random number every time
It also fallsback if it simply recieved a number instead of a table
-- For example:
-- local hunger = {10, 20}
-- local hungerAmount = GetRandomTiming(hunger)
-- print(hungerAmount) -- number between 10, 20
I kept getting people asking how to remove prints because it "was filling up their f8 menu and looked like errors"
So I've made the "success" coreloader prints to be debugmode only.
Mainly older inventories may have had issues with custom stash sizes when opening them
This should fix compatibility with changing slots and max weight with them on trigger
When collecting Jobs from the server it tries it's best to determine which role is the "Boss"
It checks first of the Job Grade label containing the word "Boss"
If it can't find it, it then uses the highest number grade and adds `.isBoss = true` to it
Found the real issue that was causing the scripts to not think you had items, basically reverting this change as i didn't like having it in the first place
Apparently qs-inv reports two variables on the item data for how you have
`count` and `amount`
while other inventories appear to only have one of those
I'm assuming for compatibility sake
Apparently the `count` is updated differently, and `hasItem()` was checking for this first
I've swapped round the checks and appears to work better
Custom inventories apparently load items separately/later into qbshared
so the script starts thinking there is definitely 0 items but its checking too early, this forces it to wait until its available to continue