This section covers the client-side functions located in integration/client/. These functions unify interactions with third-party resources like Target systems, Inventory (client actions), Fuel, Keys, and UI elements.
The lib standardizes all target interactions using the qb-target data structure. If ox_target is used, the lib automatically converts the syntax (mapping action to onSelect, job to groups, etc.).
Lib47.AddBoxZoneCreates a box zone for targeting.
--- @param name string Unique name for the zone
--- @param center vector3 Central coordinates
--- @param length number Length of the box
--- @param width number Width of the box
--- @param options table Zone options (minZ, maxZ, debugPoly, heading, useZ)
--- @param targetoptions table List of options using qb-target structure
Lib47.AddBoxZone("my_zone", vector3(100.0, 200.0, 30.0), 2.0, 2.0, {
minZ = 29.0,
maxZ = 31.0,
debugPoly = false,
heading = 90.0
}, {
options = {
{
type = "client", -- or "server", "command"
event = "myscript:client:action",
icon = "fas fa-user",
label = "Interact",
job = "police", -- qb-target standard
gang = "ballas", -- qb-target standard
item = "handcuffs", -- qb-target standard
action = function() -- Optional function support if not using event
print("Clicked")
end
}
},
distance = 2.5
})Lib47.AddPolyZoneCreates a complex polygon zone.
--- @param name string
--- @param points table List of vector3 points
--- @param options table (minZ, maxZ, debugPoly)
--- @param targetoptions table
Lib47.AddPolyZone("my_poly", {
vector3(100.0, 100.0, 30.0),
vector3(105.0, 100.0, 30.0),
vector3(105.0, 105.0, 30.0)
}, {
minZ = 29.0,
maxZ = 31.0
}, { --[[ targetoptions ]] })Lib47.AddCircleZoneCreates a spherical/circular zone.
--- @param name string
--- @param center vector3
--- @param radius number
--- @param options table
--- @param targetoptions table
Lib47.AddCircleZone("my_circle", vector3(100.0, 200.0, 30.0), 1.5, {
debugPoly = true
}, { --[[ targetoptions ]] })Lib47.AddTargetEntityAdds target options to specific entities (NetID or Local).
--- @param entities table|number Single entity or list of entities
--- @param options table qb-target standard options
Lib47.AddTargetEntity(entity, {
options = {
{
icon = "fas fa-car",
label = "Check Vehicle",
action = function(entity)
print("Checking " .. entity)
end
}
},
distance = 2.0
})Lib47.AddTargetModelAdds target options to specific models.
--- @param models string|number|table Model name/hash or list
--- @param options table
Lib47.AddTargetModel('prop_atm_01', {
options = {
{
event = "bank:open",
icon = "fas fa-money-bill",
label = "Use ATM"
}
},
distance = 1.5
})Lib47.RemoveZoneRemoves a registered zone by name.
Lib47.RemoveZone("my_zone")The lib standardizes progress bars using the ox_lib data structure.
Lib47.ShowProgressDisplays a progress bar (Circle in Ox, standard bar in QB/ESX).
--- @param data table ox_lib progress structure
--- @param successCb function (optional)
--- @param cancelCb function (optional)
--- @return boolean true if completed, false if cancelled
local success = Lib47.ShowProgress({
label = 'Repairing Vehicle...',
duration = 5000,
position = 'bottom',
useWhileDead = false,
canCancel = true,
disable = {
move = true,
car = true,
combat = true
},
anim = {
dict = 'mini@repair',
clip = 'fixing_a_ped',
flag = 49
},
prop = {
model = 'prop_tool_wrench',
bone = 57005,
pos = vec3(0.1, 0.0, 0.0),
rot = vec3(0.0, 0.0, 0.0)
}
}, function()
print("Done!")
end, function()
print("Cancelled!")
end)Lib47.NotifySends a notification to the player.
--- @param msg string Message content
--- @param type string 'success', 'error', 'info'
--- @param duration number Duration in ms
Lib47.Notify("Vehicle Repaired", "success", 5000)Lib47.OpenStashOpens a stash inventory for the player.
--- @param identifier string Unique stash ID
--- @param name string Display label
--- @param weight number Max weight (in kg or grams depending on inv)
--- @param slots number Max slots
Lib47.OpenStash("shop_stash_1", "Shop Storage", 100000, 50)Lib47.OpenSearchInventoryOpens another player's inventory (e.g., searching/robbing).
--- @param targetServerId number
Lib47.OpenSearchInventory(targetServerId)Lib47.CloseInventoryForces the inventory to close.
Lib47.CloseInventory()Lib47.SetInventoryBusySets the player's inventory state to busy (prevents opening).
--- @param state boolean
Lib47.SetInventoryBusy(true)Lib47.GiveVehicleKeyGives keys for a specific vehicle to the player.
--- @param plate string
--- @param vehicle entity
--- @param virtual boolean (optional) For temporary keys if supported
Lib47.GiveVehicleKey("ABC 123", vehicleEntity)Lib47.RemoveVehicleKeyRemoves keys from the player.
--- @param plate string
--- @param vehicle entity
Lib47.RemoveVehicleKey("ABC 123", vehicleEntity)Lib47.SetVehicleFuelSets the fuel level of a vehicle.
--- @param vehicle entity
--- @param amount number (0-100)
Lib47.SetVehicleFuel(vehicleEntity, 100.0)Lib47.StoreVehicleHousingStores a vehicle in a housing garage (Supporting CD, OkOk, JG, Loaf, Ak47).
--- @param garageId string
--- @param vehicle entity
Lib47.StoreVehicleHousing("my_house_1", vehicleEntity)Lib47.OpenGarageHousingOpens the garage menu for a specific housing property.
--- @param garageId string
Lib47.OpenGarageHousing("my_house_1")Lib47.IsDeadChecks if a player (or self) is dead. Supports Metadata checks and Animation checks.
--- @param target number|nil Target Server ID or nil for self
--- @return boolean
local dead = Lib47.IsDead() -- checks selfLib47.IsLastStandChecks if a player is in the "last stand" / downed state.
--- @param target number|nil
--- @return boolean
local downed = Lib47.IsLastStand()Lib47.IsIncapacitatedChecks if the player is either dead OR in last stand.
--- @param target number|nil
--- @return boolean
if Lib47.IsIncapacitated() then
print("Player is down or dead")
end