API

Framework Bridge (Client-side)

Framework.GetPlayerData()

Returns player data object.

local playerData = Framework.GetPlayerData()
-- Returns: table

Framework.IsPlayerLoaded()

Check if player is loaded and ready.

local isLoaded = Framework.IsPlayerLoaded()
-- Returns: boolean

Framework.GetPlayerJob()

Get player's current job.

local job = Framework.GetPlayerJob()
-- Returns: table

Framework.ShowNotification(message, type, duration)

Show notification to player.

Framework.ShowNotification("Hello World!", "success", 5000)
-- message: string - notification text
-- type: string - "success", "error", "info", "warn" (optional, default: "info")
-- duration: number - duration in ms (optional, default: 3500)

Framework Bridge (Server-side)

Framework.GetPlayer(source)

Get player object by source.

local player = Framework.GetPlayer(source)
-- source: number - player source
-- Returns: table with player data or nil

Framework.GetPlayerIdentifier(source)

Get player's unique identifier.

local identifier = Framework.GetPlayerIdentifier(source)
-- source: number - player source  
-- Returns: string - citizenid/identifier or nil

Framework.GetPlayerJob(source)

Get player's job.

local job = Framework.GetPlayerJob(source)
-- source: number - player source
-- Returns: table or nil

Framework.AddMoney(source, amount, moneyType)

Add money to player.

local success = Framework.AddMoney(source, 500, 'cash')
-- source: number - player source
-- amount: number - amount to add
-- moneyType: string - "cash", "bank", etc. (optional, default: "cash")
-- Returns: boolean - success

Framework.RemoveMoney(source, amount, moneyType)

Remove money from player.

local success = Framework.RemoveMoney(source, 100, 'cash')
-- source: number - player source
-- amount: number - amount to remove
-- moneyType: string - "cash", "bank", etc. (optional, default: "cash")
-- Returns: boolean - success (false if not enough money)

Framework.RegisterUseableItem(itemName, callback)

Register an item as useable.

Framework.RegisterUseableItem('sandwich', function(source, item)
    print("Player", source, "used", item.name)
end)
-- itemName: string - item name
-- callback: function - function to call when item is used

Framework.ShowNotification(source, message, type, duration)

Show notification to specific player.

Framework.ShowNotification(source, "Hello!", "success", 5000)
-- source: number - player source
-- message: string - notification text
-- type: string - notification type (optional)
-- duration: number - duration in ms (optional)

Inventory System (Client-side)

Inventory.CloseInventory()

Close player's inventory.

Inventory.CloseInventory()

Inventory System (Server-side)

Inventory.AddItem(source, item, amount, slot, info)

Add item to player's inventory.

local success = Inventory.AddItem(source, 'water', 5, nil, {quality = 100})
-- source: number - player source
-- item: string - item name
-- amount: number - quantity (optional, default: 1)
-- slot: number - specific slot (optional)
-- info: table - item metadata (optional)
-- Returns: boolean - success

Inventory.RemoveItem(source, item, amount, slot)

Remove item from player's inventory.

local success = Inventory.RemoveItem(source, 'water', 2)
-- source: number - player source
-- item: string - item name
-- amount: number - quantity (optional, default: 1)
-- slot: number - specific slot (optional)
-- Returns: boolean - success

Inventory.GetItem(source, item)

Get item data from player's inventory.

local itemData = Inventory.GetItem(source, 'water')
-- source: number - player source
-- item: string - item name
-- Returns: table with item data or nil

Inventory.HasItem(source, item, amount)

Check if player has item.

local hasItem = Inventory.HasItem(source, 'water', 3)
-- source: number - player source
-- item: string - item name
-- amount: number - required quantity (optional, default: 1)
-- Returns: boolean

Inventory.GetItemCount(source, item)

Get item count in player's inventory.

local count = Inventory.GetItemCount(source, 'water')
-- source: number - player source
-- item: string - item name
-- Returns: number - item count

Functions (Client-side)

API.SetEntityLookAtEntity(entity, target)

Make entity look at another entity.

API.SetEntityLookAtEntity(PlayerPedId(), targetPed)
-- entity: number - entity to rotate
-- target: number - entity to look at

API.ShowHelpNotify(text)

Show help notification.

API.ShowHelpNotify("Press ~INPUT_PICKUP~ to interact")
-- text: string - help text to display

API.CreateBoxZone(data)

Create target box zone.

local zoneId = API.CreateBoxZone({
    name = "shop_zone",
    coords = vector3(0, 0, 0),
    length = 2.0,
    width = 2.0,
    heading = 0.0,
    minZ = -1.0,
    maxZ = 1.0,
    options = {
        {
            icon = "fas fa-shopping-cart",
            label = "Open Shop",
            action = function() print("Shop opened!") end
        }
    },
    distance = 2.0
})
-- Returns: string - zone ID

API.AddTargetEntity(entity, data)

Add target to entity.

API.AddTargetEntity(ped, {
    options = {
        {
            icon = "fas fa-user",
            label = "Talk to NPC",
            action = function() print("Talking...") end
        }    
    },
    distance = 2.0
})
-- entity: number - entity handle
-- data: table - target options

API.RemoveZone(id)

Remove target zone.

API.RemoveZone(zoneId)
-- id: string - zone ID to remove

Utility Functions

Utils.Debug(message, level)

Print debug message (if Config.Debug = true).

Utils.Debug("Something happened", "info")
-- message: string - debug message
-- level: string - "info", "error", "warn", "success" (optional, default: "info")

Utils.IsResourceRunning(resourceName)

Check if resource is running.

local isRunning = Utils.IsResourceRunning('qb-core')
-- resourceName: string - resource name
-- Returns: boolean

Utils.Round(num, decimals)

Round number to specified decimals.

local rounded = Utils.Round(3.14159, 2) -- 3.14
-- num: number - number to round
-- decimals: number - decimal places (optional, default: 0)
-- Returns: number

_L(...)

Translation function.

local text = _L("Hello %s", playerName)
-- Supports string formatting and concatenation
-- Returns: string

Event System

Ready Events

-- Client
RegisterNetEvent('ic_lib:client:ready', function(frameworkName)
    print("Framework ready:", frameworkName)
end)

-- Server
RegisterNetEvent('ic_lib:server:ready', function(frameworkName)
    print("Framework ready:", frameworkName)
end)

-- Inventory ready
RegisterNetEvent('ic_lib:inventory:client:ready', function(inventoryName)
    print("Inventory ready:", inventoryName)
end)

RegisterNetEvent('ic_lib:inventory:server:ready', function(inventoryName)
    print("Inventory ready:", inventoryName)
end)

-- Target ready (client only)
RegisterNetEvent('ic_lib:target:client:ready', function(targetName)
    print("Target ready:", targetName)
end)

Player Events

-- Player loaded/unloaded
RegisterNetEvent('ic_lib:client:playerLoaded', function()
    print("Player loaded")
end)

RegisterNetEvent('ic_lib:server:playerLoaded', function(source, playerData)
    print("Player", source, "loaded")
end)

RegisterNetEvent('ic_lib:client:playerUnloaded', function()
    print("Player unloaded")
end)

RegisterNetEvent('ic_lib:server:playerUnloaded', function(source)
    print("Player", source, "unloaded")
end)

-- Job updates
RegisterNetEvent('ic_lib:client:jobUpdated', function(job)
    print("Job updated:", job.name)
end)

RegisterNetEvent('ic_lib:server:jobUpdated', function(source, job)
    print("Player", source, "job updated:", job.name)
end)

-- Money changes (QB-Core only)
RegisterNetEvent('ic_lib:client:moneyChanged', function(moneyType, amount, operation)
    print("Money changed:", moneyType, amount, operation)
end)

RegisterNetEvent('ic_lib:server:moneyChanged', function(source, moneyType, amount, operation)
    print("Player", source, "money changed:", moneyType, amount, operation)
end)

Global Variables

Framework  -- Framework bridge object
Inventory  -- Inventory bridge object  
Target     -- Target system name ("qb-target", "ox_target", "standalone", etc.)
API        -- API functions object
Utils      -- Utility functions object

Last updated