Server
Server Exports
--- Retrieves information about a player's unit from the HubList.
--- This function searches the `HubList` for a unit associated with the specified player ID.
--- @param playerId integer - The player's source ID to search for.
--- @return table , string ( A table containing the unit's data if found and its department hub; otherwise, `false` for either.
--- The unit table contains:
--- - source (integer): The player's source ID.
--- - name (string): The player's character name
--- - callsign (string): The player's callsign
--- - job (string): The player's job code
--- - coords (vector2) : The player's coords
--- - Rank (string) : The player's Grade rank
--- - Duty (boolean) : The player's Duty Status
--- - Busy (boolean) : The player's Busy Status
--- - Radio (string) : Return player's Radio Channel
--- - Dispatch (boolean) : The player's Dispatch Mode
--- The hub key is the string key identify unit department like [POLICE,EMS].
exports['l2s-dispatch']:GetUnitInfo(source)
--- Calculates the total number of units in a specified hub.
--- This function counts the number of units in the specified hub, optionally including off-duty units
--- and filtering by a specific job.
--- @param hub string - The hub name to search within.
--- @param includeOffDuty boolean - Whether to include off-duty units in the count.
--- @param SpecificJob string|nil - The specific job to filter units by. If `nil`, all jobs are included.
--- @return integer - The total number of units matching the criteria.
exports['l2s-dispatch']:GetHubTotal(hub, includeOffDuty, SpecificJob)
--- Checks if a vehicle with the specified plate exists in the BOLO database.
--- Queries the database for a vehicle entry with the given plate.
--- @param plate string - The plate of the vehicle to search for.
--- @return table|boolean - Returns the first matching record as a table if found; otherwise, `false`.
exports['l2s-dispatch']:CheckVehicle(plate)
--- Checks if the specified hub has any dispatch units available.
--- This function iterates through the units in the given hub and identifies those marked as dispatch.
--- @param hub string - The name of the hub to check.
--- @return boolean, table - Returns `true` if any dispatch units are found, otherwise `false`.
--- Also returns a table containing the source IDs of the dispatch units.
exports['l2s-dispatch']:HasDispatch(hub)
--- Sets the radio channel for the dispatch script.
--- This function adjusts the active channel for the unit, to update it in list.
--- @parm source (integer): The player's source ID.
--- @param channel number - The channel to set. Must be a positive float or string or integer representing the desired channel.
exports['l2s-dispatch']:SetChannel(source, channel)
Last updated