Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
35 changes: 35 additions & 0 deletions client/alerts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ local function VehicleTheft()
color = vehicle.color,
class = vehicle.class,
doors = vehicle.doors,
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -36,6 +37,7 @@ local function Shooting()
street = GetStreetAndZone(coords),
gender = GetPlayerGender(),
weapon = GetWeaponName(),
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -56,6 +58,7 @@ local function Hunting()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -82,6 +85,7 @@ local function VehicleShooting()
color = vehicle.color,
class = vehicle.class,
doors = vehicle.doors,
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -107,6 +111,7 @@ local function SpeedingVehicle()
color = vehicle.color,
class = vehicle.class,
doors = vehicle.doors,
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -126,6 +131,7 @@ local function Fight()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -145,6 +151,7 @@ local function PrisonBreak()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -165,6 +172,7 @@ local function StoreRobbery(camId)
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
camId = camId,
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -185,6 +193,7 @@ local function FleecaBankRobbery(camId)
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
camId = camId,
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -205,6 +214,7 @@ local function PaletoBankRobbery(camId)
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
camId = camId,
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -225,6 +235,7 @@ local function PacificBankRobbery(camId)
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
camId = camId,
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -245,6 +256,7 @@ local function VangelicoRobbery(camId)
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
camId = camId,
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -264,6 +276,7 @@ local function HouseRobbery()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -283,6 +296,7 @@ local function YachtHeist()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -302,6 +316,7 @@ local function DrugSale()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -321,6 +336,7 @@ local function SuspiciousActivity()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -346,6 +362,7 @@ local function CarJacking(vehicle)
color = vehicle.color,
class = vehicle.class,
doors = vehicle.doors,
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -365,6 +382,7 @@ local function InjuriedPerson()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = 10,
jobs = { 'ems' }
}

Expand All @@ -384,6 +402,7 @@ local function DeceasedPerson()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = 10,
jobs = { 'ems' }
}

Expand All @@ -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' }
}

Expand All @@ -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' }
}

Expand All @@ -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' }
}

Expand All @@ -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' }
}

Expand All @@ -493,6 +516,7 @@ local function Explosion()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = nil,
jobs = { 'leo' }
}

Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -591,6 +617,7 @@ local function ArtGalleryRobbery()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = nil,
jobs = { 'leo' }
}
TriggerServerEvent('ps-dispatch:server:notify', dispatchData)
Expand All @@ -609,6 +636,7 @@ local function HumaneRobbery()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = nil,
jobs = { 'leo' }
}
TriggerServerEvent('ps-dispatch:server:notify', dispatchData)
Expand All @@ -628,6 +656,7 @@ local function TrainRobbery()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = nil,
jobs = { 'leo' }
}
TriggerServerEvent('ps-dispatch:server:notify', dispatchData)
Expand All @@ -647,6 +676,7 @@ local function VanRobbery()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = nil,
jobs = { 'leo' }
}
TriggerServerEvent('ps-dispatch:server:notify', dispatchData)
Expand All @@ -666,6 +696,7 @@ local function UndergroundRobbery()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = nil,
jobs = { 'leo' }
}
TriggerServerEvent('ps-dispatch:server:notify', dispatchData)
Expand All @@ -684,6 +715,7 @@ local function DrugBoatRobbery()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -703,6 +735,7 @@ local function UnionRobbery()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -728,6 +761,7 @@ local function CarBoosting(vehicle)
color = vehicle.color,
class = vehicle.class,
doors = vehicle.doors,
alertTime = nil,
jobs = { 'leo' }
}

Expand All @@ -747,6 +781,7 @@ local function SignRobbery()
coords = coords,
gender = GetPlayerGender(),
street = GetStreetAndZone(coords),
alertTime = nil,
jobs = { 'leo'}
}

Expand Down
9 changes: 7 additions & 2 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion shared/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down