This page documents all available server-side functions in Glitch Abstraction. Functions are grouped by system and include required dependencies where applicable.
Functions on the GlitchAbst table on the server.
Framework#
| Function | What |
|---|---|
Framework.GetPlayer(source) |
Framework player object. |
Framework.GetPlayers() |
All online players. |
Framework.GetPlayerFromIdentifier(identifier) |
Player from identifier or citizenid. |
Framework.RegisterCallback(name, cb) |
The handler is function(source, respond, ...). |
Framework.GetMoney(source, account) |
Balance. |
Framework.AddMoney and RemoveMoney |
(source, amount) or (source, account, amount). |
Framework.GetBankMoney, AddBankMoney, RemoveBankMoney |
Bank account helpers. |
Framework.GetJob(source) |
name, label, grade, grade_name, grade_label, plus onduty, isboss and type on QBCore and Qbox. |
Framework.SetJob(source, job, grade) |
Returns true on success. |
Framework.RegisterUsableItem(item, cb) |
The callback is function(source, item). |
Framework.UseItem(source, item) |
Needs qb-inventory. |
Framework.HasItem(source, item, count) |
True when the player holds at least count. |
Framework.Notify(source, message, type, length) |
Framework notification. |
ESX also has DoesCallbackExist and TriggerClientCallback.
Inventory#
Common to every adapter: AddItem, RemoveItem, GetItemCount, HasItem, CanCarryItem, GetItems, RegisterUsableItem and GiveItem.
ox_inventory adds GetItem, CanCarryAmount, CanCarryWeight, SetMaxWeight, the slot helpers, GetInventory, GetInventoryItems, InspectInventory, ConfiscateInventory, ReturnInventory, ClearInventory, RegisterStash, CreateTemporaryStash, CustomDrop, CreateDropFromPlayer, GetCurrentWeapon, SetDurability, SetMetadata, ForceOpenInventory, UpdateVehicle and ConvertItems.
Hooks (ox_inventory): RegisterHook(eventName, callback, options) returns an id, RemoveHook(id) removes one, and RemoveAllHooks() removes only the hooks the calling resource added. Shortcuts: Hooks.OnSwapItems, OnOpenInventory, OnCreateItem, OnBuyItem and OnCraftItem.
qb-inventory adds LoadInventory, SaveInventory, OpenInventory, CloseInventory, OpenInventoryById, CreateShop, OpenShop, SetInventory, SetItemData, UseItem, GetFreeWeight, GetItemBySlot, GetItemByName, GetItemsByName, SetBusy, IsBusy, LockInventory and UnlockInventory.
Door locks (ox_doorlock adapter)#
GetDoor, GetDoorState, SetDoorState(door, state, playerId), LockDoor, UnlockDoor, PlayerHasAccess(source, door), GetAllDoors, AddDoor and RemoveDoor. ox_doorlock does not permission check server-side changes.
Progression#
IsAvailable(), GetXPData(source, name), AddXP(source, name, amount), RemoveXP(source, name, xp), SetXP(source, name, amount), GetLevel(source, name), InitializePlayerXP(source, cb) and RegisterXPCategory(name, label, xpStart, xpFactor, maxLevel). Without an XP resource every call returns a safe default.
Server notifications (ox_lib)#
ServerNotifications.Show(playerId, params), Broadcast(params), the typed Success, Error, Info and Warning as (playerId, title, message, duration, options), and the BroadcastSuccess, BroadcastError, BroadcastInfo and BroadcastWarning versions without a player.
Cutscene#
Cutscene.PlayFor(target, name, opts) and Cutscene.StopFor(target) back the exports of the same purpose. Names are letters, numbers and underscores only.