pen-to-squareBridge

Bridge System Documentation

Complete guide to the Bridge compatibility system for iSanz Labs


Table of Contents

  • Introduction

  • Bridge.Core

  • Bridge.Gangs

  • Bridge.Inventory

  • Bridge.Interaction

  • Bridge.MenuInput

  • Bridge.Notify

  • Bridge.Progressbar

  • Bridge.Dispatch

  • Bridge.MiniGames

  • Custom Bridge Systems

  • Popular System Examples

  • Troubleshooting


Introduction

The Bridge system is a compatibility layer that allows iSanz Labs to work with different framework systems without code modifications. It automatically adapts to your server's configuration based on Config.Base settings.

How It Works

The Bridge system:

  1. Detects which resources are installed on your server

  2. Routes function calls to the appropriate system based on Config.Base

  3. Provides a unified API for all systems

  4. Handles system-specific differences automatically

Configuration

All Bridge systems read from Config.Base in shared/config.lua:


Bridge.Core

File: bridge/core.lua

Purpose: Core framework detection and player object retrieval.

Functions

Bridge.GetCore()

Returns the core framework object and framework name.

Returns:

  • Core (table) - Framework core object

  • Framework (string) - Framework name ("qb" or "qbx")

Example:

Bridge.GetPlayer(src)

Gets player object by server source ID.

Parameters:

  • src (number) - Player server source ID

Returns:

  • Player object or nil

Example:

Supported Frameworks

  • QB-Core (qb-core)

  • QBX-Core (qbx_core)

Auto-Detection

The Bridge automatically detects which framework is running:


Bridge.Gangs

File: bridge/gangs.lua

Purpose: Gang system integration for gang-based access control.

Functions

Bridge.Gangs.GetPlayerGang()

Gets current player's gang name (client-side).

Returns:

  • string - Gang name or nil

Example:

Bridge.Gangs.GetServerGang(source)

Gets player's gang name (server-side).

Parameters:

  • source (number) - Player server source ID

Returns:

  • string - Gang name or "none"

Example:

Bridge.Gangs.GetPlayerGangData()

Gets full gang data object (client-side).

Returns:

  • table - Gang data object or nil

Example:

Bridge.Gangs.GetServerGangData(source)

Gets full gang data object (server-side).

Parameters:

  • source (number) - Player server source ID

Returns:

  • table - Gang data object or nil

Bridge.Gangs.IsPlayerInGang(source, gangName)

Checks if player is in a specific gang.

Parameters:

  • source (number) - Player server source ID

  • gangName (string) - Gang name to check

Returns:

  • boolean - true if player is in gang

Example:

Bridge.Gangs.GetAllGangs()

Gets list of all gangs in the framework.

Returns:

  • table - Array of gang objects {key = "gang_key", name = "Gang Name"}

Example:

Bridge.Gangs.SetCustomGangSystem(customSystem)

Sets a custom gang system for non-standard implementations.

Parameters:

  • customSystem (table) - Custom system with functions:

    • GetPlayerGang() - Client-side gang name

    • GetServerGang(source) - Server-side gang name

    • GetPlayerGangData() - Client-side gang data

    • GetServerGangData(source) - Server-side gang data

    • GetAllGangs() - All gangs list

Example:

Supported Systems

  • QB-Core Gangs - Uses Core.Shared.Gangs

  • QBX-Core Gangs - Uses exports.qbx_core:GetGangs()

  • Custom Systems - Via SetCustomGangSystem()


Bridge.Inventory

File: bridge/inventory.lua

Purpose: Inventory system integration for item management.

Configuration

Set Config.Base.inventory to your inventory system:

  • qb-inventory

  • ox_inventory

  • ps-inventory

  • qs-inventory

Functions

Bridge.Inventory.Search(item)

Searches for item in player inventory (client-side).

Parameters:

  • item (string) - Item name

Returns:

  • number - Item count

Example:

Bridge.Inventory.GetItemCount(source, item)

Gets item count from player inventory (server-side).

Parameters:

  • source (number) - Player server source ID

  • item (string) - Item name

Returns:

  • number - Item count

Example:

Bridge.Inventory.AddItem(source, item, quantity, metadata)

Adds item to player inventory (server-side).

Parameters:

  • source (number) - Player server source ID

  • item (string) - Item name

  • quantity (number) - Quantity to add

  • metadata (table, optional) - Item metadata

Example:

Bridge.Inventory.RemoveItem(source, item, quantity, slot)

Removes item from player inventory (server-side).

Parameters:

  • source (number) - Player server source ID

  • item (string) - Item name

  • quantity (number) - Quantity to remove

  • slot (number, optional) - Specific slot to remove from

Example:

Bridge.Inventory.GetItemMetadata(source, item, slot)

Gets item metadata from specific slot.

Parameters:

  • source (number) - Player server source ID

  • item (string) - Item name

  • slot (number) - Slot number

Returns:

  • table - Metadata or empty table

Example:

Bridge.Inventory.UpdateItemMetadata(source, item, slot, metadata)

Updates item metadata in specific slot.

Parameters:

  • source (number) - Player server source ID

  • item (string) - Item name

  • slot (number) - Slot number

  • metadata (table) - New metadata

Example:

Bridge.Inventory.OpenStash(stashName, options)

Opens a stash inventory (client-side).

Parameters:

  • stashName (string) - Stash identifier

  • options (table, optional) - Stash options:

    • maxWeight (number) - Maximum weight

    • slots (number) - Number of slots

Example:

Bridge.Inventory.Stash(gang)

Opens lab stash for specific gang (client-side).

Parameters:

  • gang (string) - Gang name

Example:

Bridge.Inventory.CreateUsableItem(item, callback)

Registers a usable item with callback.

Parameters:

  • item (string) - Item name

  • callback (function) - Callback function function(source) end

Example:

System-Specific Implementations

QB-Inventory / PS-Inventory

Uses QB-Core player objects and exports:

OX Inventory

Uses OX Inventory exports:

QS Inventory

Uses QS Inventory exports:


Bridge.Interaction

File: bridge/interaction.lua

Purpose: World interaction system integration (E key interactions, targeting, etc.).

Configuration

Set Config.Base.interact to your interaction system:

  • interact - Custom interaction system (default)

  • qb-target - QB-Target

  • ox_target - OX Target

Functions

Bridge.Interaction.AddInteraction(data)

Adds an interaction point in the world.

Parameters:

  • data (table) - Interaction data:

    • id (string) - Unique interaction ID

    • coords (vector3) - World coordinates

    • distance (number, optional) - Detection distance (default: 2.0)

    • interactDst (number, optional) - Interaction distance (default: 1.5)

    • interactionType (string, optional) - Type for sprite (default: 'key')

    • options (table, optional) - Interaction options

    • entity (number, optional) - Entity handle

    • ignoreLos (boolean, optional) - Ignore line of sight check

Options Format:

Example - Custom System:

Example - QB-Target:

Example - OX Target:

Bridge.Interaction.RemoveInteraction(id)

Removes an interaction point.

Parameters:

  • id (string) - Interaction ID

Example:

System-Specific Details

Custom Interaction System (interact)

Uses custom sprite rendering and E key detection:

  • Requires Config.Interactions configuration

  • Uses DrawInteractionSprite() function

  • Shows sprites based on interactionType

  • Supports entity-based interactions

QB-Target (qb-target)

Converts to QB-Target format:

OX Target (ox_target)

Converts to OX Target format:


Bridge.MenuInput

File: bridge/menu_input.lua

Purpose: Menu and input dialog system integration.

Configuration

Set Config.Base.menu and Config.Base.input:

  • Menu: iSanz-menu, qb-menu, ox_lib

  • Input: iSanz-input, qb-input, ox_lib

Functions

Bridge.MenuInput.OpenMenu(menu, menuId)

Opens a menu dialog.

Parameters:

  • menu (table) - Menu items array

  • menuId (string, optional) - Menu ID for tracking

Menu Format:

Example:

Bridge.MenuInput.OpenInput(inputData, inputType, inputContext)

Opens an input dialog.

Parameters:

  • inputData (table) - Input configuration

  • inputType (string) - Input type identifier

  • inputContext (table, optional) - Context data

Input Format:

Example:

Handling Input Response:

Set callback before opening input:

Bridge.MenuInput.CloseMenu()

Closes the current menu.

Example:

Bridge.MenuInput.CloseInput()

Closes the current input dialog.

Example:

System-Specific Implementations

QB-Menu / QB-Input

Menu:

Input:

OX Lib

Menu:

Input:

iSanz-Menu / iSanz-Input

Uses NUI-based system:

  • Sends NUI messages

  • Uses SetNuiFocus() for focus control

  • Requires HTML/JS implementation


Bridge.Notify

File: bridge/notify.lua

Purpose: Notification system integration for player messages.

Configuration

Set Config.Base.notify:

  • qb - QB-Core notifications

  • ox_lib - OX Lib notifications

Functions

Bridge.Notify.Client(text, notifyType, duration)

Sends notification to local player (client-side).

Parameters:

  • text (string) - Notification message

  • notifyType (string, optional) - Type: success, error, primary, info, warning

  • duration (number, optional) - Duration in milliseconds (default: 5000)

Example:

Bridge.Notify.Server(source, text, notifyType, duration)

Sends notification to specific player (server-side).

Parameters:

  • source (number) - Player server source ID

  • text (string) - Notification message

  • notifyType (string, optional) - Notification type

  • duration (number, optional) - Duration in milliseconds

Example:

Bridge.Notify.All(text, notifyType, duration)

Sends notification to all players.

Parameters:

  • text (string) - Notification message

  • notifyType (string, optional) - Notification type

  • duration (number, optional) - Duration in milliseconds

Example:

Notification Types

QB-Core:

  • success - Green success message

  • error - Red error message

  • primary - Blue primary message

  • info - Info message

OX Lib:

  • success - Success message

  • error - Error message

  • inform - Info message (converted from primary/info)

  • warning - Warning message

System-Specific Implementations

QB-Core

OX Lib


Bridge.Progressbar

File: bridge/progressbar.lua

Purpose: Progress bar system integration for timed actions.

Configuration

Set Config.Base.progressbar:

  • qb - QB-Core progressbar

  • ox - OX Lib progressbar

Function

StartProgressbar(progressType, callback, cancelCallback, customLabel, customDuration)

Starts a progress bar with animation and props.

Parameters:

  • progressType (string) - Predefined progress type

  • callback (function, optional) - Function to call on completion

  • cancelCallback (function, optional) - Function to call on cancellation

  • customLabel (string, optional) - Custom label text

  • customDuration (number, optional) - Custom duration in milliseconds

Predefined Types:

  • lab_hack_prep - Lab hack preparation (2 seconds)

  • lab_hack_finish - Lab hack completion (3 seconds)

  • laptop_hack_prep - Laptop hack (2 seconds)

  • deal_items - Item dealing (5 seconds)

  • collect_items - Item collection (3 seconds, with animation)

  • smoke_joint - Smoking joint (3 seconds, with joint prop)

  • water_plant - Watering plant (3.5 seconds, with watering can)

  • fertilize_plant - Fertilizing (3.5 seconds, with fertilizer)

  • harvest_plant - Harvesting (3.5 seconds, with animation)

  • plant_seed - Planting seed (5 seconds, with trowel)

  • craft_baggy - Bagging buds (5 seconds)

  • craft_baggy_seated - Seated bagging (8 seconds)

  • craft_doll - Crafting doll (8 seconds)

  • rolling_joint - Rolling joint (8 seconds)

Example:

Custom Progress Bar:

Progress Bar Configuration

Each progress type has:

  • name - Internal identifier

  • label - Display text

  • duration - Default duration (milliseconds)

  • disableMovement - Disable player movement

  • disableCarMovement - Disable vehicle movement

  • disableMouse - Disable mouse input

  • disableCombat - Disable combat

  • anim - Animation dictionary and clip

  • prop - Prop model and attachment

Animation Format:

Prop Format:

System-Specific Implementations

QB-Core

OX Lib


Bridge.Dispatch

File: bridge/dispatch.lua

Purpose: Police dispatch system integration for alerts.

Configuration

Configure in Config.Dispatch:

Function

Bridge.Dispatch.PoliceAlert(coords)

Sends police dispatch alert.

Parameters:

  • coords (vector3) - Alert location coordinates

Example:

Supported Systems

QB-Core (qb)

Project Sloth (ps)

Core Dispatch (cd)

Custom (custom)

No implementation (requires custom code).


Bridge.MiniGames

File: bridge/minigames.lua

Purpose: Minigame system for hacking challenges.

Function

PlayHackGame(type, options)

Plays a hack minigame.

Parameters:

  • type (string) - Minigame type: digit, minesweeper, custom

  • options (table, optional) - Minigame options

Returns:

  • boolean - true if completed successfully

Example:

Supported Types

Digit (digit)

Uses bl_ui resource:

Minesweeper (minesweeper)

Uses bl_ui resource:

Custom (custom)

Requires custom implementation in bridge/minigames.lua:

Configuration

Set in Config.MiniGames:


Custom Bridge Systems

You can extend the Bridge system for custom implementations:

Custom Gang System

Custom Dispatch System

Modify bridge/dispatch.lua:


Example 1: QB-Core + QB-Inventory + QB-Menu

Config:

Usage:

  • Uses QB-Core player objects

  • QB-Inventory exports

  • QB-Menu for menus

  • QB-Target for interactions

  • QB-Core notifications and progressbars

Example 2: QB-Core + OX Inventory + OX Lib

Config:

Usage:

  • QB-Core for framework

  • OX Inventory for items

  • OX Lib for menus, inputs, progressbars, notifications

  • OX Target for interactions

Example 3: QBX-Core + OX Inventory

Config:

Usage:

  • QBX-Core framework (detected automatically)

  • Full OX Lib integration

  • OX Inventory for items

Example 4: Custom Interaction System

Config:

Usage:

  • Custom sprite-based interactions

  • Requires Config.Interactions configuration

  • Uses NUI-based menu/input system


Troubleshooting

Bridge System Not Working

Problem: Bridge functions return nil or don't work.

Solutions:

  1. Check resource names match Config.Base exactly

  2. Ensure resources are started before iSanz_Labs

  3. Verify resource names in fxmanifest.lua dependencies

  4. Check server console for Bridge errors

Inventory Functions Not Working

Problem: Items not adding/removing correctly.

Solutions:

  1. Verify Config.Base.inventory matches your inventory resource name

  2. Check item names exist in your inventory database

  3. Ensure inventory resource exports are working

  4. Test inventory exports directly in server console

Interaction System Not Showing

Problem: Interactions don't appear.

Solutions:

  1. Check Config.Base.interact setting

  2. For custom system, ensure Config.Interactions is configured

  3. Verify interaction coordinates are correct

  4. Check if target system (qb-target/ox_target) is running

Problem: Menus or inputs don't open.

Solutions:

  1. Verify menu/input resource names in Config.Base

  2. Check if resources are started

  3. For NUI systems, verify HTML files are loaded

  4. Check browser console (F8) for NUI errors

Notifications Not Showing

Problem: Notifications don't appear.

Solutions:

  1. Check Config.Base.notify setting

  2. Verify notification resource is running

  3. Test notification exports directly

  4. Check for console errors


Summary

The Bridge system provides a unified API for multiple framework systems:

  • Bridge.Core - Framework detection and player objects

  • Bridge.Gangs - Gang system integration

  • Bridge.Inventory - Item management

  • Bridge.Interaction - World interactions

  • Bridge.MenuInput - Menus and inputs

  • Bridge.Notify - Notifications

  • Bridge.Progressbar - Progress bars

  • Bridge.Dispatch - Police alerts

  • Bridge.MiniGames - Hacking minigames

All systems automatically adapt based on Config.Base settings, providing seamless compatibility across different server setups.


Support

  • Documentation: This file

  • Version: v3.0.0-BETA

  • Last Updated: 2025


Note: Always test Bridge configuration changes on a development server before applying to production. Resource names must match exactly (case-sensitive).

Last updated

Was this helpful?