diff --git a/README.md b/README.md index b89f7797..c8288963 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,13 @@ Do not create issues on GitHub if you need help. Issues are for bug reporting an - On shared/config.lua make set Config.Debug = true to test calls as police officer.(ONLY to be used as testing, make sure to disable on live production) * How to change colors of the calls? - - Priority 1 is red and priority 2 is normal on the config. + - Priority 1 is red and priority 2 is normal on the config. + +* To increase the time that calls are shown on the screen, do the following: + - Find the "alerts.lua" file in the client folder. + - Open this file with a text editor or a development tool like Visual Studio Code. + - Look for the code "alertTime = nil". + - Replace "nil" with the number of seconds you want the calls to display. For example, setting "alertTime = 25" means calls will be shown for 25 seconds. # Credits * [OK1ez](https://github.com/OK1ez) diff --git a/client/alerts.lua b/client/alerts.lua index 48a2b781..c35a0d15 100644 --- a/client/alerts.lua +++ b/client/alerts.lua @@ -16,6 +16,7 @@ local function VehicleTheft() color = vehicle.color, class = vehicle.class, doors = vehicle.doors, + alertTime = nil, jobs = { 'leo' } } @@ -36,6 +37,7 @@ local function Shooting() street = GetStreetAndZone(coords), gender = GetPlayerGender(), weapon = GetWeaponName(), + alertTime = nil, jobs = { 'leo' } } @@ -56,6 +58,7 @@ local function Hunting() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = nil, jobs = { 'leo' } } @@ -82,6 +85,7 @@ local function VehicleShooting() color = vehicle.color, class = vehicle.class, doors = vehicle.doors, + alertTime = nil, jobs = { 'leo' } } @@ -107,6 +111,7 @@ local function SpeedingVehicle() color = vehicle.color, class = vehicle.class, doors = vehicle.doors, + alertTime = nil, jobs = { 'leo' } } @@ -126,6 +131,7 @@ local function Fight() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = nil, jobs = { 'leo' } } @@ -145,6 +151,7 @@ local function PrisonBreak() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = nil, jobs = { 'leo' } } @@ -165,6 +172,7 @@ local function StoreRobbery(camId) gender = GetPlayerGender(), street = GetStreetAndZone(coords), camId = camId, + alertTime = nil, jobs = { 'leo' } } @@ -185,6 +193,7 @@ local function FleecaBankRobbery(camId) gender = GetPlayerGender(), street = GetStreetAndZone(coords), camId = camId, + alertTime = nil, jobs = { 'leo' } } @@ -205,6 +214,7 @@ local function PaletoBankRobbery(camId) gender = GetPlayerGender(), street = GetStreetAndZone(coords), camId = camId, + alertTime = nil, jobs = { 'leo' } } @@ -225,6 +235,7 @@ local function PacificBankRobbery(camId) gender = GetPlayerGender(), street = GetStreetAndZone(coords), camId = camId, + alertTime = nil, jobs = { 'leo' } } @@ -245,6 +256,7 @@ local function VangelicoRobbery(camId) gender = GetPlayerGender(), street = GetStreetAndZone(coords), camId = camId, + alertTime = nil, jobs = { 'leo' } } @@ -264,6 +276,7 @@ local function HouseRobbery() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = nil, jobs = { 'leo' } } @@ -283,6 +296,7 @@ local function YachtHeist() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = nil, jobs = { 'leo' } } @@ -302,6 +316,7 @@ local function DrugSale() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = nil, jobs = { 'leo' } } @@ -321,6 +336,7 @@ local function SuspiciousActivity() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = nil, jobs = { 'leo' } } @@ -346,6 +362,7 @@ local function CarJacking(vehicle) color = vehicle.color, class = vehicle.class, doors = vehicle.doors, + alertTime = nil, jobs = { 'leo' } } @@ -365,6 +382,7 @@ local function InjuriedPerson() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = 10, jobs = { 'ems' } } @@ -384,6 +402,7 @@ local function DeceasedPerson() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = 10, jobs = { 'ems' } } @@ -405,6 +424,7 @@ local function OfficerDown() street = GetStreetAndZone(coords), name = PlayerData.charinfo.firstname .. " " .. PlayerData.charinfo.lastname, callsign = PlayerData.metadata["callsign"], + alertTime = 10, jobs = { 'ems', 'leo' } } @@ -428,6 +448,7 @@ local function OfficerBackup() street = GetStreetAndZone(coords), name = PlayerData.charinfo.firstname .. " " .. PlayerData.charinfo.lastname, callsign = PlayerData.metadata["callsign"], + alertTime = 10, jobs = { 'ems', 'leo' } } @@ -451,6 +472,7 @@ local function OfficerInDistress() street = GetStreetAndZone(coords), name = PlayerData.charinfo.firstname .. " " .. PlayerData.charinfo.lastname, callsign = PlayerData.metadata["callsign"], + alertTime = 10, jobs = { 'ems', 'leo' } } @@ -472,6 +494,7 @@ local function EmsDown() street = GetStreetAndZone(coords), name = PlayerData.charinfo.firstname .. " " .. PlayerData.charinfo.lastname, callsign = PlayerData.metadata["callsign"], + alertTime = 10, jobs = { 'ems', 'leo' } } @@ -493,6 +516,7 @@ local function Explosion() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = nil, jobs = { 'leo' } } @@ -522,6 +546,7 @@ local function CustomAlert(data) name = data.name or nil, vehicle = data.model or nil, plate = data.plate or nil, + alertTime = data.alertTime or nil, doorCount = data.doorCount or nil, automaticGunfire = data.automaticGunfire or false, alert = { @@ -562,6 +587,7 @@ local function PhoneCall(message, anonymous, job) number = anonymous and locale('hidden_number') or PlayerData.charinfo.phone, information = message, street = GetStreetAndZone(coords), + alertTime = nil, jobs = job } @@ -591,6 +617,7 @@ local function ArtGalleryRobbery() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = nil, jobs = { 'leo' } } TriggerServerEvent('ps-dispatch:server:notify', dispatchData) @@ -609,6 +636,7 @@ local function HumaneRobbery() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = nil, jobs = { 'leo' } } TriggerServerEvent('ps-dispatch:server:notify', dispatchData) @@ -628,6 +656,7 @@ local function TrainRobbery() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = nil, jobs = { 'leo' } } TriggerServerEvent('ps-dispatch:server:notify', dispatchData) @@ -647,6 +676,7 @@ local function VanRobbery() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = nil, jobs = { 'leo' } } TriggerServerEvent('ps-dispatch:server:notify', dispatchData) @@ -666,6 +696,7 @@ local function UndergroundRobbery() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = nil, jobs = { 'leo' } } TriggerServerEvent('ps-dispatch:server:notify', dispatchData) @@ -684,6 +715,7 @@ local function DrugBoatRobbery() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = nil, jobs = { 'leo' } } @@ -703,6 +735,7 @@ local function UnionRobbery() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = nil, jobs = { 'leo' } } @@ -728,6 +761,7 @@ local function CarBoosting(vehicle) color = vehicle.color, class = vehicle.class, doors = vehicle.doors, + alertTime = nil, jobs = { 'leo' } } @@ -747,6 +781,7 @@ local function SignRobbery() coords = coords, gender = GetPlayerGender(), street = GetStreetAndZone(coords), + alertTime = nil, jobs = { 'leo'} } diff --git a/client/main.lua b/client/main.lua index 146f6140..280576c2 100644 --- a/client/main.lua +++ b/client/main.lua @@ -83,12 +83,15 @@ local function setWaypoint() if not data then return end + if data.alertTime == nil then data.alertTime = Config.AlertTime end + local timer = data.alertTime * 1000 + if not waypointCooldown and lib.table.contains(data.jobs, PlayerData.job.type) then SetNewWaypoint(data.coords.x, data.coords.y) TriggerServerEvent('ps-dispatch:server:attach', data.id, PlayerData) lib.notify({ description = locale('waypoint_set'), position = 'top', type = 'success' }) waypointCooldown = true - SetTimeout(Config.AlertTime * 1000, function() + SetTimeout(timer, function() waypointCooldown = false end) end @@ -243,7 +246,9 @@ local OpenDispatchMenu = lib.addKeybind({ -- Events RegisterNetEvent('ps-dispatch:client:notify', function(data, source) - local timer = Config.AlertTime * 1000 + if data.alertTime == nil then data.alertTime = Config.AlertTime end + local timer = data.alertTime * 1000 + if alertsDisabled then return end if not isJobValid(data.jobs) then return end if not IsOnDuty() then return end diff --git a/shared/config.lua b/shared/config.lua index dd99f806..5a4d58df 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -4,7 +4,7 @@ Config.Debug = false -- Enables debug and send alerts when leo break the law. Config.RespondKeybind = 'E' Config.OpenDispatchMenu = 'O' -Config.AlertTime = 5 -- How many seconds you want the alert to stay on screen +Config.AlertTime = 5 -- Specify the duration for the alert to appear on the screen. The default time is 5 seconds for all alerts. To set a different duration for specific alerts, change the value in `alertTime = nil` found in the alerts.lua file. Config.MaxCallList = 25 -- maximum dispatch calls in dispatch list Config.OnDutyOnly = true -- Set true if only on duty players can see the alert