Bridge
Free, open-source framework layer used by every GR1M resource. Install it once and GR1M scripts run on Qbox, QBCore or ESX Legacy, with ox_inventory, qb-inventory (or ps/lj) or the framework's own inventory.
#Install
- Requires ox_lib.
- Drop
GR1M_Bridgeinto your resources. - Start it after your framework and inventory, and before any GR1M resource:
ensure ox_lib
ensure qbx_core # or qb-core / es_extended
ensure ox_inventory # or your inventory
ensure GR1M_Bridge
ensure GR1M_ThrottleControl # GR1M resources after this
- Optional admin ACE:
add_ace group.admin gr1m.admin allow
On start the console prints which framework and inventory it picked. Force either one in config.lua.
#Using it in your own scripts
-- fxmanifest.lua
shared_script '@GR1M_Bridge/import.lua'
#Server
| Function | Returns |
|---|---|
Bridge.GetIdentifier(src) | citizenid (QB/Qbox) or identifier (ESX) |
Bridge.GetName(src) | Character name |
Bridge.GetJob(src) / Bridge.GetGang(src) | { name, label, grade, gradeLabel, isBoss, onDuty } (gang is nil on ESX) |
Bridge.HasJob(src, 'police' or {'police','sheriff'}, minGrade) | boolean |
Bridge.SetJob(src, name, grade) / Bridge.SetDuty(src, onDuty) | boolean (duty is a no-op on ESX) |
Bridge.GetMoney(src, 'cash'/'bank'/'dirty') | number |
Bridge.AddMoney(src, account, amount, reason) / Bridge.RemoveMoney(...) | boolean |
Bridge.GetItemCount(src, item, metadata) / Bridge.HasItem(src, item, count) | number / boolean |
Bridge.AddItem(src, item, count, metadata) / Bridge.RemoveItem(...) / Bridge.CanCarryItem(...) | boolean |
Bridge.AddSocietyMoney(job, amount) / RemoveSocietyMoney / GetSocietyMoney | Renewed-Banking, qb-management or esx_addonaccount |
Bridge.IsAdmin(src) | ACE gr1m.admin, plus framework admins if enabled |
Bridge.Notify(src, message, type, duration, title) | ox_lib notify |
Bridge.GetPlayers() / Bridge.GetSourceFromIdentifier(id) | list / source |
"Dirty" money is the black_money account on ESX and an item on QB/Qbox (set the item name in config.lua).
#Client
Bridge.GetPlayerData(), Bridge.GetIdentifier(), Bridge.GetJob(), Bridge.GetGang(), Bridge.HasJob(jobs, minGrade), Bridge.IsLoaded(), Bridge.Notify(message, type, duration, title).
Events: GR1M_Bridge:client:playerLoaded, playerUnloaded, jobUpdated (job), gangUpdated (gang).
#Other frameworks
Set BridgeConfig.Framework = 'custom' and fill in custom/server.lua and custom/client.lua. Society banking for anything else goes in BridgeHooks in custom/server.lua.
GR1M