### Job System Integration Source: https://docs.nights-software.com/resources/objectives Example of displaying job-specific instructions to the player. ```lua -- Display job instructions exports.night_objectives:DisplayObjective(true, "Police Duty", "Patrol the city and respond to calls", "Use /911 to respond to emergencies", 60) ``` -------------------------------- ### Display Subtitle Usage Examples Source: https://docs.nights-software.com/resources/subtitles Various examples demonstrating how to call the subtitle export with different text lengths and durations. ```lua -- Basic subtitle display exports.night_subtitles:DisplaySubtitle("Welcome to Nights SoftwareπŸ™‚. It's time for some real subtitles!", 5000) -- Short subtitle exports.night_subtitles:DisplaySubtitle("Hello World", 3000) -- Long subtitle exports.night_subtitles:DisplaySubtitle("This is a longer subtitle message that will be displayed for a longer duration", 8000) ``` -------------------------------- ### Get System Setting Source: https://docs.nights-software.com/resources/nightShifts Retrieves the value of a specific configuration setting by its key. ```lua local mdt = exports['night_shifts_mdt'] print(mdt:GetSetting('currency'), mdt:GetSetting('speedUnit')) ``` -------------------------------- ### Configure fxmanifest dependency Source: https://docs.nights-software.com/resources/naturalDisasters Example of how to comment out the xSound dependency in the fxmanifest.lua file. ```lua -- dependency 'xsound' ``` -------------------------------- ### Add resource to server.cfg Source: https://docs.nights-software.com/resources/naturalDisasters Command to start the Natural Disasters resource on the server. ```text ensure night_natural_disasters ``` -------------------------------- ### Ensure Postal Dependencies Source: https://docs.nights-software.com/resources/nightShifts Start required libraries and postal resources in your server.cfg before the MDT. ```text ensure ox_lib ensure nearest-postal ``` -------------------------------- ### Add Resource to server.cfg Source: https://docs.nights-software.com/resources/discordAPI Add this line to your server.cfg file to ensure the resource starts correctly. ```text ensure night_discordapi ``` -------------------------------- ### Mission System Integration Source: https://docs.nights-software.com/resources/objectives Example of displaying an objective for a mission and clearing it upon completion. ```lua -- Display mission objective exports.night_objectives:DisplayObjective(true, "Deliver Package", "Take the package to the marked location", "Follow the GPS route", 30) -- Clear when mission completes exports.night_objectives:ClearObjective() ``` -------------------------------- ### Enable Dynamic Door Creation Source: https://docs.nights-software.com/resources/metabuild Set the game variable for dynamic door creation in server.cfg before starting scripts. ```text setr game_enableDynamicDoorCreation "true" ``` -------------------------------- ### Ensure oxmysql Dependency Source: https://docs.nights-software.com/resources/metabuild Add the oxmysql resource to server.cfg, ensuring it is started before MetaBuild. ```text ensure oxmysql ``` -------------------------------- ### Ensure oxmysql Resource Source: https://docs.nights-software.com/resources/stormChasing Add the oxmysql resource to your server.cfg file to ensure it starts before the Storm Chasing resource. ```text ensure oxmysql ``` -------------------------------- ### StartShiftByServerId(serverId, departmentId, subDepartmentId, rankId, callsign) Source: https://docs.nights-software.com/resources/nightShifts Starts a new shift for the specified player. ```APIDOC ## StartShiftByServerId(serverId, departmentId, subDepartmentId, rankId, callsign) ### Description Starts a shift for a player. The player must already have an active MDT session. ### Parameters - **serverId** (number) - Required - Player server ID. - **departmentId** (number) - Required - Department ID. - **subDepartmentId** (number) - Optional - Sub-department ID. - **rankId** (number) - Required - Rank ID. - **callsign** (string) - Required - Callsign for the shift. ### Returns - **success** (boolean) - Operation status. - **result** (table/string) - Shift details or error message. ### Example ```lua local success, result = exports['night_shifts_mdt']:StartShiftByServerId(source, deptId, nil, rankId, "L-42") ``` ``` -------------------------------- ### Ensure module load order Source: https://docs.nights-software.com/resources/cbrnDisasters Defines the required sequence for starting disaster-related modules to prevent dependency conflicts. ```text ensure night_air_raid_sirens ensure night_natural_disasters ensure night_cbrn_disasters ``` -------------------------------- ### Spawn Disaster from External Resource Source: https://docs.nights-software.com/resources/cbrnDisasters Example implementation for triggering a disaster from another resource with error handling. ```lua local runId, err = exports['night_cbrn_disasters']:SpawnDisaster('rogue_warhead') if not runId then print('Spawn failed:', err) else print('Started disaster run', runId) end ``` -------------------------------- ### Start a New Shift Source: https://docs.nights-software.com/resources/nightShifts Initializes a shift for a player using department and rank IDs. Requires an active MDT session. ```lua local mdt = exports['night_shifts_mdt'] local depts = mdt:GetDepartments() local dept = nil for _, d in ipairs(depts) do if d.departmentName == "LSPD" then dept = d; break end end if not dept then return end local ranks = mdt:GetRanksByDepartmentId(dept.id) local rank = nil for _, r in ipairs(ranks) do if r.rankName == "Officer" then rank = r; break end end if not rank then return end local success, result = mdt:StartShiftByServerId(source, dept.id, nil, rank.id, "L-42") if success then print("Clocked in:", result.callsign) else print("Failed:", tostring(result)) end ``` -------------------------------- ### Configure MetaBuild in server.cfg Source: https://docs.nights-software.com/resources/metabuild Add this line to your server.cfg file to ensure the resource loads on server startup. ```text ensure night_metabuild ``` -------------------------------- ### Get Player Callsign Source: https://docs.nights-software.com/resources/nightShifts Retrieves the current shift callsign for the local player. Requires the resource to be started and the player to have opened the MDT at least once. ```lua if GetResourceState("night_shifts_mdt") == "started" then local callsign = exports['night_shifts_mdt']:GetPlayerCallsign() if callsign then print("Callsign: " .. callsign) else print("Player is not on shift") end else print("[ERROR] You have enabled the callsign feature but night_shifts_mdt is not started.") end ``` -------------------------------- ### Configure Server Resource Source: https://docs.nights-software.com/resources/ammoBox Add this line to your server.cfg file to ensure the resource loads on server startup. ```text ensure night_ammobox ``` -------------------------------- ### Configure server.cfg for Garage System Source: https://docs.nights-software.com/resources/garageSystem Add this line to your server.cfg file to ensure the resource loads upon server startup. ```text ensure night_garage_system ``` -------------------------------- ### Configure server.cfg for Objectives Source: https://docs.nights-software.com/resources/objectives Add this line to your server.cfg file to ensure the resource loads on server startup. ```text ensure night_objectives ``` -------------------------------- ### Get Current Shift Duration Source: https://docs.nights-software.com/resources/nightShifts Returns the duration of the current shift in seconds. ```lua local seconds = exports['night_shifts_mdt']:GetCurrentShiftDurationByServerId(source) ``` -------------------------------- ### Configure xSound in server.cfg Source: https://docs.nights-software.com/resources/naturalDisasters Ensure the xSound resource is loaded early in the server startup sequence. ```text ensure xsound ``` -------------------------------- ### Configure server.cfg for Discord Allowlist Source: https://docs.nights-software.com/resources/discordAllowlist Add this line to your server.cfg file to ensure the resource loads on server startup. ```text ensure night_discordallowlist ``` -------------------------------- ### Get Active Departments Source: https://docs.nights-software.com/resources/nightShifts Retrieves a list of all currently active departments from the cache. ```lua for _, d in ipairs(exports['night_shifts_mdt']:GetDepartments()) do print(d.id, d.departmentName) end ``` -------------------------------- ### Configure server.cfg for Advanced Player Tracking Source: https://docs.nights-software.com/resources/advancedPlayerTracking Add this line to your server.cfg file to ensure the resource loads on server startup. ```text ensure night_advancedTracking ``` -------------------------------- ### Configure MySQL Connection String Source: https://docs.nights-software.com/resources/metabuild Define the database connection string in server.cfg. Ensure this is placed before resource startup. ```text set mysql_connection_string "user=Your_Database_Username;password=Your_Database_Password;host=Your_Database_Host;port=3306;database=Your_Database_Name;charset=utf8mb4_general_ci" ``` ```text set mysql_connection_string "user=root;password=;host=localhost;port=3306;database=Your_Database_Name;charset=utf8mb4_general_ci" ``` -------------------------------- ### Get Discord Guild Information Source: https://docs.nights-software.com/resources/discordAPI Retrieves metadata for a configured Discord server. ```lua local guildData = exports['night_discordapi']:GetDiscordGuild("Your Guild Name", false) if guildData then print("Guild ID: " .. guildData.id) print("Guild Name: " .. guildData.name) print("Owner ID: " .. guildData.ownerid) end ``` -------------------------------- ### Configure server.cfg for Coma & Down System Source: https://docs.nights-software.com/resources/comaAndDownSystem Add this line to your server.cfg file to ensure the resource loads on server startup. ```text ensure night_coma_down_system ``` -------------------------------- ### Configure server.cfg for Vehicle Rentals Source: https://docs.nights-software.com/resources/vehicleRentals Add this line to your server.cfg file to ensure the resource loads on server startup. ```text ensure night_rentals ``` -------------------------------- ### Client Exports Source: https://docs.nights-software.com/resources/ers Client-side exports available for starting pursuits and requesting NPC backup. ```APIDOC ## Client Exports ### Description Functions available on the client side for triggering pursuits and managing NPC backup services. ### Usage - **Start Pursuit**: Used by callouts and other integrations to initiate a pursuit sequence. - **NPC Backup**: Used by other resources to request pursuit or service-related NPC backup. ``` -------------------------------- ### Register Resources in server.cfg Source: https://docs.nights-software.com/resources/discordWelcome Add these lines to your server.cfg file to ensure the resources load in the correct order. ```text ensure night_discordapi ensure night_discord_welcome ``` -------------------------------- ### Get Discord User Information Source: https://docs.nights-software.com/resources/discordAPI Retrieves user data from Discord for the specified source. ```lua -- Get and display user information local userData = exports['night_discordapi']:GetDiscordUser(source, false) if userData then TriggerClientEvent('chat:addMessage', -1, { color = {0, 255, 0}, multiline = true, args = {"Discord", userData.name .. " joined the server!"} }) end ``` -------------------------------- ### Get Sirens in Area Source: https://docs.nights-software.com/resources/airRaidSirens Fetches configuration data for a specific siren area by name. ```lua -- Returns configuration data for a specific area local areaData = exports['night_air_raid_sirens']:GetSirensInArea(areaName) -- Example usage local areaData = exports['night_air_raid_sirens']:GetSirensInArea("Fort Zancudo") -- Returns: table with {soundFile, soundReach, soundVolume, enabled, poleCount, poles} ``` -------------------------------- ### Configure server.cfg for Gemstone Mining Job Source: https://docs.nights-software.com/resources/gemstoneMiningJob Add this line to your server.cfg file to ensure the resource loads on server startup. ```text ensure night_gemstone_mining ``` -------------------------------- ### Get Available Areas Source: https://docs.nights-software.com/resources/airRaidSirens Retrieves a list of all configured siren areas and their current settings. ```lua -- Returns array of all configured areas with their settings local areas = exports['night_air_raid_sirens']:GetAvailableAreas() -- Returns: table with {name, poleCount, soundFile, soundReach, soundVolume, enabled} ``` -------------------------------- ### Activate Sirens by Zone Source: https://docs.nights-software.com/resources/airRaidSirens Example of triggering sirens based on a specific location, such as a storm event. ```lua -- Server-side, called from your storm/tornado resource local tornadoCoords = GetTornadoPosition() -- your own function local closestZone, zonesInRange = exports['night_air_raid_sirens']:GetZoneForCoords( tornadoCoords.x, tornadoCoords.y, tornadoCoords.z ) if #zonesInRange > 0 then exports['night_air_raid_sirens']:TriggerAirRaidSirensByAreaExport("air-raid-siren", zonesInRange) else exports['night_air_raid_sirens']:DeactivateAllAirRaidSirensExport() end ``` -------------------------------- ### Execute Permissions in server.cfg Source: https://docs.nights-software.com/resources/acePerms Include the permissions configuration file in the main server configuration. ```text exec perms.cfg ``` -------------------------------- ### Retrieve MDT Settings Source: https://docs.nights-software.com/resources/nightShifts Fetches the full configuration table, including alert durations and other defaults. ```lua local settings = exports['night_shifts_mdt']:GetAllSettings() ``` -------------------------------- ### GetSetting(key) Source: https://docs.nights-software.com/resources/nightShifts Retrieves a specific system setting value by its key. ```APIDOC ## GetSetting(key) ### Description Returns the value for a specific configuration setting. ### Parameters - **key** (string) - Required - The setting key (e.g., 'currency', 'timeFormat'). ### Returns - **Any** - The value associated with the key. ``` -------------------------------- ### Get Ranks by Department ID Source: https://docs.nights-software.com/resources/nightShifts Retrieves an array of rank rows for a specified department ID. ```lua local ranks = exports['night_shifts_mdt']:GetRanksByDepartmentId(1) ``` -------------------------------- ### GetAllSettings() Source: https://docs.nights-software.com/resources/nightShifts Retrieves the full configuration settings for the MDT, including defaults and alert durations. ```APIDOC ## GetAllSettings() ### Description Retrieves the full settings (defaults merged with DB), including alertDurations and similar. ### Returns - **Table** - Full settings object. ### Example ```lua local settings = exports['night_shifts_mdt']:GetAllSettings() ``` ``` -------------------------------- ### Send Callout Offers to Players Source: https://docs.nights-software.com/resources/ers Examples of using SendCalloutOfferToPlayer to trigger a dispatch prompt on the client side. ```lua local ok, err = exports['night_ers']:SendCalloutOfferToPlayer(src) if not ok then print(('Could not offer callout: %s'):format(err or '?')) else -- Player has the accepting / declining timed prompt exactly like `/requestcallout`. end local ok2, err2 = exports['night_ers']:SendCalloutOfferToPlayer(src, 'callout_vehicle_theft', 6000) ``` -------------------------------- ### Organize server.cfg Source: https://docs.nights-software.com/resources/installation-guide Use this structure to maintain clear separation between core, gameplay, and utility resources in your server configuration. ```text # ======================================== # CORE RESOURCES # ======================================== ensure oxmysql ensure night_discordapi # ======================================== # GAMEPLAY RESOURCES # ======================================== ensure night_natural_disasters ensure night_objectives ensure night_garage_system # ======================================== # UTILITY RESOURCES # ======================================== ensure night_easy_zones ensure night_loading_screen ``` -------------------------------- ### Get Sub-Departments by Department ID Source: https://docs.nights-software.com/resources/nightShifts Retrieves an array of sub-department rows associated with a specific department ID. ```lua local sub = exports['night_shifts_mdt']:GetSubDepartmentsByDepartmentId(1) ``` -------------------------------- ### Standard Resource Directory Structure Source: https://docs.nights-software.com/resources/installation-guide Follow this directory layout to ensure resources are correctly recognized by the server environment. ```text resource_folder/ β”œβ”€β”€ fxmanifest.lua β”œβ”€β”€ config/ β”‚ └── config.lua β”œβ”€β”€ client/ β”‚ └── client.lua β”œβ”€β”€ server/ β”‚ └── server.lua └── nui/ └── images/ ``` -------------------------------- ### Configure server.cfg for Landing Zone Alarm Source: https://docs.nights-software.com/resources/landingZoneAlarm Add this line to your server.cfg file to ensure the resource loads upon server startup. ```text ensure night_lzalarm ``` -------------------------------- ### Configure server.cfg for Air Raid Sirens Source: https://docs.nights-software.com/resources/airRaidSirens Add this line to your server.cfg file to ensure the resource loads upon server startup. ```text ensure night_air_raid_sirens ``` -------------------------------- ### Starting a Pursuit Source: https://docs.nights-software.com/resources/ers Initiates pursuit mode for a specific ped using their network ID. Requires the player to be on police service. ```lua local netId = NetworkGetNetworkIdFromEntity(suspectPed) local started = exports['night_ers']:StartPursuit(netId) ``` -------------------------------- ### Get Active Shift Details Source: https://docs.nights-software.com/resources/nightShifts Retrieves the shift object for a specific server ID, returning nil if the player is not on shift. ```lua local shift = exports['night_shifts_mdt']:GetActiveShiftByServerId(source) if shift then print(shift.callsign, shift.departmentId, shift.statusCode) end ``` -------------------------------- ### Configure Radiation Shelter Settings Source: https://docs.nights-software.com/resources/cbrnDisasters Enable and configure radiation shelter detection, including support for custom housing exports. ```lua Config.RadiationShelter = { Enabled = true, InteriorNative = true, -- vanilla GTA interiors count automatically HousingExportResource = nil, -- e.g. 'rtx_housing' HousingExportName = nil, -- e.g. 'IsPlayerInsideProperty' } ``` -------------------------------- ### Configure server.cfg for Weapon Crates Source: https://docs.nights-software.com/resources/weaponCrates Add this line to your server.cfg file to ensure the resource loads on server startup. ```text ensure night_discord_weaponcrates ```