Server
This page documents all available server-side functions in Glitch Abstraction. Functions are grouped by system and include required dependencies where applicable.
Framework Functions
Required Resource: One of: ESX Legacy, QBCore, or QBox
Player Management
GlitchLib.Framework.GetPlayer(source)Get player objectGlitchLib.Framework.GetPlayerFromIdentifier(identifier)Get player from identifier/citizenidGlitchLib.Framework.GetPlayers()Get all online players
Money Management
GlitchLib.Framework.GetMoney(source)Get player's cashGlitchLib.Framework.AddMoney(source, amount)Add cash to playerGlitchLib.Framework.RemoveMoney(source, amount)Remove cash from playerGlitchLib.Framework.GetBankMoney(source)Get player's bank balanceGlitchLib.Framework.AddBankMoney(source, amount)Add to player's bank balanceGlitchLib.Framework.RemoveBankMoney(source, amount)Remove from player's bank balance
Job Management
GlitchLib.Framework.GetJob(source)Get player's jobGlitchLib.Framework.SetJob(source, job, grade)Set player's job and grade
Notification & Callbacks
GlitchLib.Framework.RegisterCallback(name, callback)Register a server callbackGlitchLib.Framework.Notify(source, message, type, length)Send notification to player
Inventory Functions
Required Resource: One of: ox_inventory, qb-inventory, or ESX inventory
Item Management
GlitchLib.Inventory.AddItem(source, item, amount, metadata, slot, info, reason)Add item to player QB does NOT use metadata and OX does NOT use info, or reasonGlitchLib.Inventory.RemoveItem(source, item, count, metadata, slot)Remove item from playerGlitchLib.Inventory.GetItem(source, item, metadata)Get item data for playerGlitchLib.Inventory.GetItemCount(source, item, metadata)Get count of item player hasGlitchLib.Inventory.CanAddItem(source, item, amount)Check if player can carry itemGlitchLib.Inventory.CanCarryItem(source, item, count)Check if player can carry itemGlitchLib.Inventory.CanSwapItem(source, item, count, toSlot)Check if player can swap item slotsGlitchLib.Inventory.SetInventory(source, items)Set player's entire inventoryGlitchLib.Inventory.ClearInventory(source)Clear player's inventoryGlitchLib.Inventory.SetItemData(source, itemName, key, val)Set specific data for an itemGlitchLib.Inventory.UseItem(itemName, callback)Register item usage handler
Inventory Management
GlitchLib.Inventory.OpenInventory(source, invType, data)Open inventory for playerGlitchLib.Inventory.CloseInventory(source, identifier)Close inventory for playerGlitchLib.Inventory.OpenInventoryById(source, playerId)Open another player's inventoryGlitchLib.Inventory.ConfiscateInventory(source)Confiscate player inventory (ox)GlitchLib.Inventory.ReturnInventory(source)Return confiscated inventory (ox)GlitchLib.Inventory.ClearInventory(inv, keep)Clear specific inventory with optional keeps
Stash Management
GlitchLib.Inventory.RegisterStash(id, label, slots, maxWeight, owner, groups, coords)Register stashGlitchLib.Inventory.CreateTemporaryStash(properties)Create temporary stash (ox)GlitchLib.Inventory.OpenShop(source, name)Open shop menuGlitchLib.Inventory.CreateShop(shopData)Create custom shop
Drop Management
GlitchLib.Inventory.CustomDrop(prefix, items, coords, slots, maxWeight, instance, model)Create dropGlitchLib.Inventory.CreateDropFromPlayer(playerId)Create drop from player inventory
Item Lookup
GlitchLib.Inventory.GetFreeWeight(source)Get remaining weight capacityGlitchLib.Inventory.GetSlots(identifier)Get slot data for inventoryGlitchLib.Inventory.GetSlotsByItem(items, itemName)Get all slots containing specific itemGlitchLib.Inventory.GetFirstSlotByItem(items, itemName)Get first slot with specific itemGlitchLib.Inventory.GetItemBySlot(source, slot)Get item in specific slotGlitchLib.Inventory.GetItemByName(source, item)Get first instance of itemGlitchLib.Inventory.GetItemsByName(source, item)Get all instances of itemGlitchLib.Inventory.Search(source, search, item, metadata)Search inventory (ox)GlitchLib.Inventory.GetSlot(source, slot)Get item in specific slot (ox)GlitchLib.Inventory.SwapSlots(source, fromSlot, toSlot)Swap inventory slots (ox)
Inventory State Control
GlitchLib.Inventory.SetBusy(source, state)Set inventory busy stateGlitchLib.Inventory.LockInventory(source)Lock player inventoryGlitchLib.Inventory.UnlockInventory(source)Unlock player inventory
Notification Functions
Required Resource: ox_lib for server-side notifications
Basic Notifications
GlitchLib.ServerNotifications.Show(playerId, params)Send notification to specific playerGlitchLib.ServerNotifications.Broadcast(params)Send notification to all playersGlitchLib.ServerNotifications.Success(playerId, title, message, duration, options)Send success notificationGlitchLib.ServerNotifications.Error(playerId, title, message, duration, options)Send error notificationGlitchLib.ServerNotifications.Info(playerId, title, message, duration, options)Send info notificationGlitchLib.ServerNotifications.Warning(playerId, title, message, duration, options)Send warning notification
Broadcast Helpers
GlitchLib.ServerNotifications.BroadcastSuccess(title, message, duration, options)Broadcast successGlitchLib.ServerNotifications.BroadcastError(title, message, duration, options)Broadcast errorGlitchLib.ServerNotifications.BroadcastInfo(title, message, duration, options)Broadcast infoGlitchLib.ServerNotifications.BroadcastWarning(title, message, duration, options)Broadcast warning
Direct Access to ox_lib Notifications
GlitchLib.ServerNotifications.Ox.Show(playerId, params)Send ox_lib notification to playerGlitchLib.ServerNotifications.Ox.Broadcast(params)Broadcast ox_lib notification to allGlitchLib.ServerNotifications.Ox.Success(playerId, title, message, duration, options)Send ox successGlitchLib.ServerNotifications.Ox.Error(playerId, title, message, duration, options)Send ox errorGlitchLib.ServerNotifications.Ox.Info(playerId, title, message, duration, options)Send ox infoGlitchLib.ServerNotifications.Ox.Warning(playerId, title, message, duration, options)Send ox warningGlitchLib.ServerNotifications.Ox.Custom(playerId, params)Send custom ox notificationGlitchLib.ServerNotifications.Ox.WithSound(playerId, params, soundBank, soundSet, soundName)Send with soundGlitchLib.ServerNotifications.Ox.BroadcastSuccess(title, message, duration, options)Broadcast ox successGlitchLib.ServerNotifications.Ox.BroadcastError(title, message, duration, options)Broadcast ox errorGlitchLib.ServerNotifications.Ox.BroadcastInfo(title, message, duration, options)Broadcast ox infoGlitchLib.ServerNotifications.Ox.BroadcastWarning(title, message, duration, options)Broadcast ox warning
Door Lock Functions
Required Resource: One of: ox_doorlock, qb-doorlock, or esx_doorlock
GlitchLib.DoorLock.GetDoorState(door)Get door state (locked/unlocked)GlitchLib.DoorLock.SetDoorState(door, state, playerId)Set door stateGlitchLib.DoorLock.PlayerHasAccess(source, door)Check if player has access to doorGlitchLib.DoorLock.GetAllDoors()Get all doorsGlitchLib.DoorLock.AddDoor(door)Add a new door (if supported)GlitchLib.DoorLock.RemoveDoor(door)Remove a door (if supported)
Progression Functions
Required Resource: pickle_xp
Experience Management
GlitchLib.Progression.GetXP(source)Get player's XPGlitchLib.Progression.AddXP(source, amount, reason)Add XP to playerGlitchLib.Progression.SetXP(source, amount)Set player's XPGlitchLib.Progression.GetLevel(source)Get player's levelGlitchLib.Progression.SetLevel(source, level)Set player's levelGlitchLib.Progression.AddLevels(source, amount)Add levels to player
XP Sources
GlitchLib.Progression.RegisterXPSource(name, min, max, notify)Register XP sourceGlitchLib.Progression.AwardXPFromSource(source, sourceName)Award XP from source
Rank Management
GlitchLib.Progression.GetRankData(source)Get player's rank dataGlitchLib.Progression.GetUserData(source)Get player's user dataGlitchLib.Progression.HasRank(source, rank)Check if player has specific rank
Last updated