From 4f7d56471bf31105fabd139402edc62331c974f9 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 5 Nov 2020 15:33:21 +0000 Subject: [PATCH] Added ability to clear the BOLO plate --- cl_plate_reader.lua | 19 +++++++++++++++++-- nui/radar.css | 2 +- nui/radar.html | 2 ++ nui/radar.js | 6 ++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/cl_plate_reader.lua b/cl_plate_reader.lua index aa817de..5439d51 100644 --- a/cl_plate_reader.lua +++ b/cl_plate_reader.lua @@ -114,13 +114,21 @@ end -- Returns the bolo plate function READER:GetBoloPlate() - return self.vars.boloPlate + if ( self.vars.boloPlate ~= nil ) then + return self.vars.boloPlate + end end -- Sets the bolo plate to the given plate function READER:SetBoloPlate( plate ) self.vars.boloPlate = plate - UTIL:Notify( "BOLO plate set to: " .. plate ) + UTIL:Notify( "BOLO plate set to: ~b~" .. plate ) +end + +-- Clears the BOLO plate +function READER:ClearBoloPlate() + self.vars.boloPlate = nil + UTIL:Notify( "~b~BOLO plate cleared!" ) end -- Returns if the given reader is locked @@ -187,6 +195,13 @@ RegisterNUICallback( "setBoloPlate", function( plate, cb ) cb('ok') end ) +-- Runs when the "Clear BOLO Plate" button is pressed on the plate reader box +RegisterNUICallback( "clearBoloPlate", function( plate, cb ) + -- Clear the BOLO plate + READER:ClearBoloPlate() + cb( "ok" ) +end ) + -- This is the main function that runs and scans all vehicles in front and behind the patrol vehicle function READER:Main() -- Check that the system can actually run diff --git a/nui/radar.css b/nui/radar.css index 4079723..71cd123 100644 --- a/nui/radar.css +++ b/nui/radar.css @@ -770,7 +770,7 @@ button:focus { outline: none; } #plateReaderBox { width: 225px; - height: 300px; + height: 330px; position: absolute; margin: auto; diff --git a/nui/radar.html b/nui/radar.html index 7277949..2e8b232 100644 --- a/nui/radar.html +++ b/nui/radar.html @@ -245,6 +245,8 @@ + + diff --git a/nui/radar.js b/nui/radar.js index 808e9be..9914771 100644 --- a/nui/radar.js +++ b/nui/radar.js @@ -89,6 +89,7 @@ const elements = plateReaderBox: $( "#plateReaderBox" ), boloText: $( "#boloText" ), setBoloBtn: $( "#setBoloPlate" ), + clearBoloBtn: $( "#clearBoloPlate" ), closePrBtn: $( "#closePlateReaderSettings" ), openHelp: $( "#helpBtn" ), @@ -766,6 +767,11 @@ elements.setBoloBtn.click( function() { } } ) +// Sets the on click function for the clear BOLO button +elements.clearBoloBtn.click( function() { + sendData( "clearBoloPlate", null ); +} ) + // Checks what the user is typing into the plate box function checkPlateInput( event ) {