diff --git a/cl_radar.lua b/cl_radar.lua index e876b5d..99bbb73 100644 --- a/cl_radar.lua +++ b/cl_radar.lua @@ -77,6 +77,84 @@ Citizen.CreateThread( function() end end ) +--[[---------------------------------------------------------------------------------- + Plate reader variables + + NOTE - This is not a config, do not touch anything unless you know what + you are actually doing. +----------------------------------------------------------------------------------]]-- +READER = {} +READER.vars = +{ + -- Whether or not the radar's UI is visible + displayed = true, + + -- Whether or not the radar should be hidden, e.g. the display is active but the player then steps + -- out of their vehicle + hidden = false, + + cams = { + ["front"] = { + plate = nil, + index = nil + }, + + ["rear"] = { + plate = nil, + index = nil + } + } +} + +function READER:SetPlate( cam, plate ) + self.vars.cams[cam].plate = plate +end + +function READER:SetIndex( cam, index ) + self.vars.cams[cam].index = index +end + +function READER:CanPerformMainTask() + return self.vars.displayed and not self.vars.hidden +end + +function READER:GetCamFromNum( relPos ) + if ( relPos == 1 ) then + return "front" + elseif ( relPos == -1 ) then + return "rear" + end +end + +function READER:Main() + if ( PLY:VehicleStateValid() and self:CanPerformMainTask() ) then + for i = 1, -1, -2 do + local start = GetEntityCoords( PLY.veh ) + local offset = GetOffsetFromEntityInWorldCoords( PLY.veh, 0.0, ( 50.0 * i ), 0.0 ) + local veh = UTIL:GetVehicleInDirection( PLY.veh, start, offset ) + + if ( DoesEntityExist( veh ) and IsEntityAVehicle( veh ) ) then + local plate = GetVehicleNumberPlateText( veh ) + local index = GetVehicleNumberPlateTextIndex( veh ) + + local cam = self:GetCamFromNum( i ) + + self:SetPlate( cam, plate ) + self:SetIndex( cam, index ) + + SendNUIMessage( { _type = "changePlate", cam = cam, plate = plate, index = index } ) + end + end + end +end + +Citizen.CreateThread( function() + while ( true ) do + READER:Main() + + Citizen.Wait( 500 ) + end +end ) --[[---------------------------------------------------------------------------------- Radar variables @@ -273,7 +351,7 @@ function RADAR:ToggleDisplayState() self.vars.displayed = not self.vars.displayed -- Send the toggle message to the NUI side - SendNUIMessage( { _type = "toggleDisplay", state = self:GetDisplayState() } ) + SendNUIMessage( { _type = "setRadarDisplayState", state = self:GetDisplayState() } ) end -- Gets the display state @@ -1547,10 +1625,10 @@ end ) function RADAR:RunDisplayValidationCheck() if ( ( ( PLY.veh == 0 or ( PLY.veh > 0 and not PLY.vehClassValid ) ) and self:GetDisplayState() and not self:GetDisplayHidden() ) or IsPauseMenuActive() and self:GetDisplayState() ) then self:SetDisplayHidden( true ) - SendNUIMessage( { _type = "toggleDisplay", state = false } ) + SendNUIMessage( { _type = "setRadarDisplayState", state = false } ) elseif ( PLY.veh > 0 and PLY.vehClassValid and PLY.inDriverSeat and self:GetDisplayState() and self:GetDisplayHidden() ) then self:SetDisplayHidden( false ) - SendNUIMessage( { _type = "toggleDisplay", state = true } ) + SendNUIMessage( { _type = "setRadarDisplayState", state = true } ) end end diff --git a/cl_utils.lua b/cl_utils.lua index 89a3f81..dec87bf 100644 --- a/cl_utils.lua +++ b/cl_utils.lua @@ -53,7 +53,7 @@ function UTIL:Values( xs ) end function UTIL:GetVehicleInDirection( entFrom, coordFrom, coordTo ) - local rayHandle = StartShapeTestCapsule( coordFrom.x, coordFrom.y, coordFrom.z, coordTo.x, coordTo.y, coordTo.z, 20.0, 10, entFrom, 7 ) + local rayHandle = StartShapeTestCapsule( coordFrom.x, coordFrom.y, coordFrom.z, coordTo.x, coordTo.y, coordTo.z, 5.0, 10, entFrom, 7 ) local _, hitEntity, endCoords, surfaceNormal, vehicle = GetShapeTestResult( rayHandle ) return vehicle end diff --git a/fxmanifest.lua b/fxmanifest.lua index 0896295..826fb8b 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -19,6 +19,7 @@ files { "nui/jquery-3.4.1.min.js", "nui/radar.js", "nui/images/*", + "nui/images/plates/*", "nui/fonts/*", "nui/sounds/*" } diff --git a/nui/fonts/plate-font-hilite.ttf b/nui/fonts/plate-font-hilite.ttf new file mode 100644 index 0000000..4f25663 Binary files /dev/null and b/nui/fonts/plate-font-hilite.ttf differ diff --git a/nui/fonts/plate-font-lolite.ttf b/nui/fonts/plate-font-lolite.ttf new file mode 100644 index 0000000..a8679d1 Binary files /dev/null and b/nui/fonts/plate-font-lolite.ttf differ diff --git a/nui/fonts/plate-font-shadow.ttf b/nui/fonts/plate-font-shadow.ttf new file mode 100644 index 0000000..e5c9761 Binary files /dev/null and b/nui/fonts/plate-font-shadow.ttf differ diff --git a/nui/fonts/plate-font.ttf b/nui/fonts/plate-font.ttf new file mode 100644 index 0000000..10026aa Binary files /dev/null and b/nui/fonts/plate-font.ttf differ diff --git a/nui/images/plates/plate01.png b/nui/images/plates/0.png similarity index 100% rename from nui/images/plates/plate01.png rename to nui/images/plates/0.png diff --git a/nui/images/plates/plate02.png b/nui/images/plates/1.png similarity index 100% rename from nui/images/plates/plate02.png rename to nui/images/plates/1.png diff --git a/nui/images/plates/plate03.png b/nui/images/plates/2.png similarity index 100% rename from nui/images/plates/plate03.png rename to nui/images/plates/2.png diff --git a/nui/images/plates/plate04.png b/nui/images/plates/3.png similarity index 100% rename from nui/images/plates/plate04.png rename to nui/images/plates/3.png diff --git a/nui/images/plates/plate05.png b/nui/images/plates/4.png similarity index 100% rename from nui/images/plates/plate05.png rename to nui/images/plates/4.png diff --git a/nui/images/plates/yankton_plate.png b/nui/images/plates/5.png similarity index 100% rename from nui/images/plates/yankton_plate.png rename to nui/images/plates/5.png diff --git a/nui/images/pr_bg.png b/nui/images/pr_bg.png new file mode 100644 index 0000000..90382fa Binary files /dev/null and b/nui/images/pr_bg.png differ diff --git a/nui/images/pr_bg.psd b/nui/images/pr_bg.psd new file mode 100644 index 0000000..3a5bccc Binary files /dev/null and b/nui/images/pr_bg.psd differ diff --git a/nui/images/pr_frame.png b/nui/images/pr_frame.png new file mode 100644 index 0000000..88ad627 Binary files /dev/null and b/nui/images/pr_frame.png differ diff --git a/nui/images/pr_frame.psd b/nui/images/pr_frame.psd new file mode 100644 index 0000000..541b851 Binary files /dev/null and b/nui/images/pr_frame.psd differ diff --git a/nui/radar.css b/nui/radar.css index ae9d1fa..7954015 100644 --- a/nui/radar.css +++ b/nui/radar.css @@ -13,6 +13,26 @@ src: url( "fonts/Heebo-Regular.ttf" ); } +@font-face { + font-family: "Plate-Font"; + src: url( "fonts/plate-font.ttf" ); +} + +@font-face { + font-family: "Plate-Font-Hilite"; + src: url( "fonts/plate-font-hilite.ttf" ); +} + +@font-face { + font-family: "Plate-Font-Lolite"; + src: url( "fonts/plate-font-lolite.ttf" ); +} + +@font-face { + font-family: "Plate-Font-Shadow"; + src: url( "fonts/plate-font-Shadow.ttf" ); +} + * { font-family: 'Heebo', Verdana, Geneva, Tahoma, sans-serif; font-size: 13px; @@ -48,7 +68,7 @@ button:focus { outline: none; } z-index: 1; } -.frame_border { +#radarFrame .frame_border { width: 685px; height: 210px; @@ -543,25 +563,22 @@ button:focus { outline: none; } line-height: 62px; } - #rc .vol_ps_container { + #rc .plate_reader_and_help_container { width: 90%; display: grid; grid-template-columns: 1fr 1fr; justify-items: center; } - #rc .vol_ps_container .vol_and_test, - #rc .vol_ps_container .ps_blank { + #rc .plate_reader_and_help_container .plate_reader, + #rc .plate_reader_and_help_container .help { width: 80px; height: 55px; border-radius: 7px; } - #rc .vol_ps_container .hold { - border-bottom: 2px solid rgb( 0, 0, 0 ); - } - - #rc .vol_ps_container .ps_blank { - padding: 0 10px; + #rc .plate_reader_and_help_container .help { + padding: 0 10px; + font-size: 15px; } #rc .light { @@ -580,11 +597,145 @@ button:focus { outline: none; } #rc .blue { background-color: rgb( 84, 210, 255 ); - } + } + +#plateReaderFrame { + width: 500px; + height: 200px; + + position: absolute; + margin: auto; + + top: calc( 50% - ( 200px / 2 ) ); + left: calc( 50% - ( 500px / 2 ) ); + + background-image: url( "images/pr_frame.png" ); + + transition: transform 0.5s; + + /* Settings for scaling */ + transform: scale( 1.0 ); + transform-origin: 0 0; + + /* background-color: rgb(70, 70, 70); + box-shadow: inset 0px 20px 20px -15px rgba( 0, 0, 0, 0.4 ); */ +} + #plateReaderFrame .frame_border { + width: 465px; + height: 175px; + + position: absolute; + margin: auto; + top: 0; + right: 0; + bottom: 0; + left: 0; + + background-color: rgb( 20, 22, 18 ); + + border-radius: 5px; + + /* clip-path: polygon( 20px 2px, 665px 2px, 682px 30%, 682px 70%, 665px 208px, 20px 208px, 3px 70%, 3px 30% ); */ + } + +#plateReader { + width: 460px; + height: 170px; + + position: absolute; + margin: auto; + top: 0; + right: 0; + bottom: 0; + left: 0; + + background-image: url( "images/pr_bg.png" ); + + box-shadow: inset 0px 20px 20px -15px rgba( 0, 0, 0, 0.4 ); + + display: grid; + grid-template-rows: 30px 1fr 30px; + align-content: center; +} + #plateReader .labels { + display: grid; + grid-template-columns: 1fr 1fr; + align-content: center; + } + #plateReader .labels .title { + color: rgb( 255, 255, 255 ); + } + + #plateReader .labels p { + margin: 0; + text-align: center; + font-size: 18px; + } + + #plateReader .plates { + width: 100%; + height: 100%; + + display: grid; + grid-template-columns: 1fr 1fr; + align-content: center; + justify-items: center; + } + #plateReader .plates .plate_container { + width: 90%; + height: 100%; + + display: grid; + grid-template-columns: 1fr; + justify-content: center; + } + #plateReader .plates .plate_container .plate { + display: block; + max-width: 100%; + height: auto; + grid-column: 1; + grid-row: 1; + } + + #plateReader .plates .plate_container .text_container { + grid-column: 1; + grid-row: 1; + + display: grid; + grid-template-columns: 1fr; + justify-content: center; + } + #plateReader .plates .plate_container .text_container .text { + display: block; + font-family: "Plate-Font"; + font-size: 58px; + text-align: center; + letter-spacing: -3px; + color: rgb(0, 0, 163); + padding-top: 5px; + margin: 0; + grid-column: 1; + grid-row: 1; + } + + #plateReader .plates .plate_container .text_container .hilite { + font-family: "Plate-Font-Hilite"; + color: rgb( 93, 65, 255 ); + } + + #plateReader .plates .plate_container .text_container .lolite { + font-family: "Plate-Font-Lolite"; + color: rgb( 255, 255, 255 ); + } + + #plateReader .plates .plate_container .text_container .shadow { + font-family: "Plate-Font-Shadow"; + color: rgb( 100, 100, 100 ); + } #uiSettingsBox { width: 250px; - height: 325px; + height: 375px; position: absolute; margin: auto; @@ -617,7 +768,7 @@ button:focus { outline: none; } } #uiSettingsBox .scaling_container { - height: 150px; + height: 225px; display: grid; grid-template-rows: 1fr 1fr; } diff --git a/nui/radar.html b/nui/radar.html index 6b05bf1..b2ece13 100644 --- a/nui/radar.html +++ b/nui/radar.html @@ -6,7 +6,6 @@
-Wraith ARS 2X
-FRONT
+REAR
+
+
+ 46EEK872
+46EEK872
+46EEK872
+46EEK872
+
+
+ 46EEK872
+46EEK872
+46EEK872
+46EEK872
+LOCKED
+LOCKED
+Reader Scale
+1.00x
+