Added new plate hit BOLO sound

This commit is contained in:
Dan
2020-02-19 09:34:55 +00:00
parent 5b8695397b
commit a00b5417ef
4 changed files with 19 additions and 7 deletions

View File

@@ -104,7 +104,7 @@ function READER:GetCamLocked( cam )
end end
-- Locks the given reader -- Locks the given reader
function READER:LockCam( cam ) function READER:LockCam( cam, playAudio )
-- Check that plate readers can actually be locked -- Check that plate readers can actually be locked
if ( PLY:VehicleStateValid() and self:CanPerformMainTask() ) then if ( PLY:VehicleStateValid() and self:CanPerformMainTask() ) then
-- Toggle the lock state -- Toggle the lock state
@@ -115,8 +115,12 @@ function READER:LockCam( cam )
-- Play a beep -- Play a beep
if ( self:GetCamLocked( cam ) ) then if ( self:GetCamLocked( cam ) ) then
if ( playAudio ) then
SendNUIMessage( { _type = "audio", name = "beep", vol = RADAR:GetSettingValue( "plateAudio" ) } ) SendNUIMessage( { _type = "audio", name = "beep", vol = RADAR:GetSettingValue( "plateAudio" ) } )
end end
TriggerEvent( "wk:onPlateLocked", cam, self:GetPlate( cam ), self:GetIndex( cam ) )
end
end end
end end
@@ -186,11 +190,16 @@ function READER:Main()
-- Automatically lock the plate if the scanned plate matches the BOLO -- Automatically lock the plate if the scanned plate matches the BOLO
if ( plate == self:GetBoloPlate() ) then if ( plate == self:GetBoloPlate() ) then
self:LockCam( cam ) self:LockCam( cam, false )
SendNUIMessage( { _type = "audio", name = "plate_hit", vol = RADAR:GetSettingValue( "plateAudio" ) } )
end end
-- Send the plate information to the NUI side to update the UI -- Send the plate information to the NUI side to update the UI
SendNUIMessage( { _type = "changePlate", cam = cam, plate = plate, index = index } ) SendNUIMessage( { _type = "changePlate", cam = cam, plate = plate, index = index } )
-- Trigger the event so developers can hook into the scanner
TriggerEvent( "wk:onPlateScanned", cam, plate, index )
end end
end end
end end

View File

@@ -1626,12 +1626,12 @@ function RunControlManager()
-- Locks front plate reader -- Locks front plate reader
if ( IsDisabledControlJustPressed( 1, CONFIG.plate_front_lock_key ) ) then if ( IsDisabledControlJustPressed( 1, CONFIG.plate_front_lock_key ) ) then
READER:LockCam( "front" ) READER:LockCam( "front", true )
end end
-- Locks front plate reader -- Locks front plate reader
if ( IsDisabledControlJustPressed( 1, CONFIG.plate_rear_lock_key ) ) then if ( IsDisabledControlJustPressed( 1, CONFIG.plate_rear_lock_key ) ) then
READER:LockCam( "rear" ) READER:LockCam( "rear", true )
end end
end end

View File

@@ -27,7 +27,10 @@ const audioNames =
front: "front.ogg", front: "front.ogg",
rear: "rear.ogg", rear: "rear.ogg",
closing: "closing.ogg", closing: "closing.ogg",
away: "away.ogg" away: "away.ogg",
// Plate reader
plate_hit: "plate_hit.ogg"
} }
// Defines which audio needs to play for which direction // Defines which audio needs to play for which direction

BIN
nui/sounds/plate_hit.ogg Normal file

Binary file not shown.