Script integration
Server exports

Server Exports

Misc

GetEquippedTablet

---@param source number
---@return string | nil
local tabletId = exports["lb-tablet"]:GetEquippedTablet(source)

GetSourceFromTablet

---@param tabletId string
---@return number | nil
local source = exports["lb-tablet"]:GetSourceFromTablet(tabletId)

GetSettings

---@param tabletId string
---@return table | nil
local settings = exports["lb-phone"]:GetSettings(tabletId)

Notifications

SendNotification

---@class Notification
---@field tabletId? string
---@field source? number
---@field app string
---@field title string
---@field content? string
---@field thumbnail? string
---@field avatar? string
---@field showAvatar? boolean
 
---@param notification Notification
---@return number
local notificationId = exports["lb-tablet"]:SendNotification(notification)

NotifyEveryone

---@param notification Notification
---@param saveToDatabase? boolean # If this is set to true, people who are not online will also receive a notification
exports["lb-tablet"]:NotifyEveryone(notification, saveToDatabase)

NotifyTablets

---@param tabletIds string[]
---@param notification Notification
---@param excludeTablets? string[]
exports["lb-tablet"]:NotifyTablets(tabletIds, notification, excludeTablets)

Police Dispatch

AddDispatch

---@class Dispatch
---@field priority 'high' | 'medium' | 'low'
---@field code string
---@field title string
---@field description string
---@field location { label: string, coords: { x: number, y: number } | vector2 }
---@field time number # The duration of the dispatch in seconds
---@field fields? { icon: string, label: string, value?: string }[]
 
---@param dispatch Dispatch
---@return number
local dispatchId = exports["lb-tablet"]:AddDispatch(dispatch)

GetDispatch

---@param dispatchId number
---@return Dispatch | nil
local dispatch = exports["lb-tablet"]:GetDispatch(dispatchId)

RemoveDispatch

---@param dispatchId number
---@return boolean
local success = exports["lb-tablet"]:RemoveDispatch(dispatchId)

Police Jail

LogJailed

---@param prisoner string # The player's identifier
---@param jailedBy string # The police officer's identifier
---@param reason string
---@param jailTime number The jail time in seconds
---@param relatedCase? number # The case ID
---@return false | number
local jailId = exports["lb-tablet"]:LogJailed(prisoner, jailedBy, reason, jailTime, relatedCase)

GetJailed

---@class JailData
---@field id number
---@field identifier string
---@field name string
---@field jailedBy string
---@field remainingTime number
---@field jailedAt number
---@field avatar? string
---@field description? string
 
---@param identifier string
---@return false | JailData
local jailed = exports["lb-tablet"]:GetJailed(identifier)

UpdateJailSentence

---@param identifier string
---@param time number # The new jail time in seconds
---@return boolean
local success = exports["lb-tablet"]:UpdateJailSentence(identifier, time)