diff --git a/cl_plate_reader.lua b/cl_plate_reader.lua index aad7af7..53d332a 100644 --- a/cl_plate_reader.lua +++ b/cl_plate_reader.lua @@ -15,26 +15,30 @@ READER = {} ----------------------------------------------------------------------------------]]-- READER.vars = { - -- Whether or not the radar's UI is visible + -- Whether or not the plate reader's UI is visible displayed = false, - -- Whether or not the radar should be hidden, e.g. the display is active but the player then steps + -- Whether or not the plate reader should be hidden, e.g. the display is active but the player then steps -- out of their vehicle hidden = false, + -- The BOLO plate boloPlate = "", + -- Cameras, this table contains all of the data needed for operation of the front and rear plate reader cams = { + -- Variables for the front camera ["front"] = { - plate = "", - index = "", - locked = false + plate = "", -- The current plate caught by the reader + index = "", -- The index of the current plate + locked = false -- If the reader is locked }, + -- Variables for the rear camera ["rear"] = { - plate = "", - index = "", - lockec = false + plate = "", -- The current plate caught by the reader + index = "", -- The index of the current plate + locked = false -- If the reader is locked } } } @@ -44,7 +48,7 @@ function READER:GetDisplayState() return self.vars.displayed end --- Toggles the display state of the radar system +-- Toggles the display state of the plate reader system function READER:ToggleDisplayState() -- Toggle the display variable self.vars.displayed = not self.vars.displayed @@ -63,48 +67,63 @@ function READER:GetDisplayHidden() return self.vars.hidden end +-- Returns the stored plate for the given reader function READER:GetPlate( cam ) return self.vars.cams[cam].plate end +-- Sets the plate for the given reader to the given plate function READER:SetPlate( cam, plate ) self.vars.cams[cam].plate = plate end +-- Returns the stored plate index for the given reader function READER:GetIndex( cam ) return self.vars.cams[cam].index end +-- Sets the plate index for the given reader to the given index function READER:SetIndex( cam, index ) self.vars.cams[cam].index = index end +-- Returns the bolo plate function READER:GetBoloPlate() return self.vars.boloPlate end +-- Sets the bolo plate to the given plate function READER:SetBoloPlate( plate ) self.vars.boloPlate = plate UTIL:Notify( "BOLO plate set to: " .. plate ) end +-- Returns if the given reader is locked function READER:GetCamLocked( cam ) return self.vars.cams[cam].locked end +-- Locks the given reader function READER:LockCam( cam ) + -- Check that plate readers can actually be locked if ( PLY:VehicleStateValid() and self:CanPerformMainTask() ) then + -- Toggle the lock state self.vars.cams[cam].locked = not self.vars.cams[cam].locked + -- Tell the NUI side to show/hide the lock icon SendNUIMessage( { _type = "lockPlate", cam = cam, state = self:GetCamLocked( cam ) } ) + + -- Play a beep SendNUIMessage( { _type = "audio", name = "beep", vol = RADAR:GetSettingValue( "beep" ) } ) end end +-- Returns if the plate reader system can perform tasks function READER:CanPerformMainTask() return self.vars.displayed and not self.vars.hidden end +-- Returns if the given relative position value is for front or rear function READER:GetCamFromNum( relPos ) if ( relPos == 1 ) then return "front" @@ -119,32 +138,56 @@ RegisterNUICallback( "togglePlateReaderDisplay", function() READER:ToggleDisplayState() end ) --- Runs when the "Toggle Display" button is pressed on the plate reder box +-- Runs when the "Set BOLO Plate" button is pressed on the plate reader box RegisterNUICallback( "setBoloPlate", function( plate, cb ) + -- Set the BOLO plate READER:SetBoloPlate( plate ) 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 if ( PLY:VehicleStateValid() and self:CanPerformMainTask() ) then + -- Loop through front (1) and rear (-1) for i = 1, -1, -2 do - local start = GetEntityCoords( PLY.veh ) - local offset = GetOffsetFromEntityInWorldCoords( PLY.veh, 0.0, ( 40.0 * i ), 0.0 ) + -- Get the world position of the player's vehicle + local pos = GetEntityCoords( PLY.veh ) + + -- Get a start position 5m in front/behind the player's vehicle + local start = GetOffsetFromEntityInWorldCoords( PLY.veh, 0.0, ( 5.0 * i ), 0.0 ) + + -- Get the end position 40m in front/behind the player's vehicle + local offset = GetOffsetFromEntityInWorldCoords( PLY.veh, -2.5, ( 50.0 * i ), 0.0 ) + + -- Run the ray trace to get a vehicle local veh = UTIL:GetVehicleInDirection( PLY.veh, start, offset ) + -- Get the plate reader text for front/rear local cam = self:GetCamFromNum( i ) + -- Only proceed to read a plate if the hit entity is a valid vehicle and the current camera isn't locked if ( DoesEntityExist( veh ) and IsEntityAVehicle( veh ) and not self:GetCamLocked( cam ) ) then + -- Get the licence plate text from the vehicle local plate = GetVehicleNumberPlateText( veh ) + + -- Get the licence plate index from the vehicle local index = GetVehicleNumberPlateTextIndex( veh ) + -- Only update the stored plate if it's different, otherwise we'd keep sending a NUI message to update the displayed + -- plate and image even though they're the same if ( self:GetPlate( cam ) ~= plate ) then + -- Set the plate for the current reader self:SetPlate( cam, plate ) + + -- Set the plate index for the current reader self:SetIndex( cam, index ) + -- Automatically lock the plate if the scanned plate matches the BOLO if ( plate == self:GetBoloPlate() ) then self:LockCam( cam ) end + -- Send the plate information to the NUI side to update the UI SendNUIMessage( { _type = "changePlate", cam = cam, plate = plate, index = index } ) end end @@ -152,14 +195,20 @@ function READER:Main() end end +-- Main thread Citizen.CreateThread( function() while ( true ) do + -- Run the main plate reader function READER:Main() + -- Wait half a second Citizen.Wait( 500 ) end end ) +-- This function is pretty much straight from WraithRS, it does the job so I didn't see the point in not +-- using it. Hides the radar UI when certain criteria is met, e.g. in pause menu or stepped out ot the +-- patrol vehicle function READER: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 ) @@ -170,12 +219,15 @@ function READER:RunDisplayValidationCheck() end end +-- Runs the display validation check for the radar Citizen.CreateThread( function() Citizen.Wait( 100 ) - while ( true ) do + while ( true ) do + -- Run the check READER:RunDisplayValidationCheck() + -- Wait half a second Citizen.Wait( 500 ) end end ) \ No newline at end of file diff --git a/cl_radar.lua b/cl_radar.lua index ecd2c2e..82d9b7d 100644 --- a/cl_radar.lua +++ b/cl_radar.lua @@ -35,16 +35,20 @@ end ) ----------------------------------------------------------------------------------]]-- local spawned = false +-- Runs every time the player spawns, but the additional check means it only runs the first time +-- the player spawns AddEventHandler( "playerSpawned", function() - if ( not spawned ) then - TriggerServerEvent( "wk:getUiData" ) - spawned = true - end + if ( not spawned ) then + -- Ask the server to get the player's saved UI data + TriggerServerEvent( "wk:getUiData" ) + spawned = true + end end ) +-- Grabs the saved UI data sent by the server and forwards it to the NUI side RegisterNetEvent( "wk:loadUiData" ) AddEventHandler( "wk:loadUiData", function( data ) - SendNUIMessage( { _type = "loadUiSettings", data = data } ) + SendNUIMessage( { _type = "loadUiSettings", data = data } ) end ) --[[---------------------------------------------------------------------------------- @@ -52,10 +56,10 @@ end ) ----------------------------------------------------------------------------------]]-- PLY = { - ped = PlayerPedId(), - veh = nil, - inDriverSeat = false, - vehClassValid = false + ped = PlayerPedId(), + veh = nil, + inDriverSeat = false, + vehClassValid = false } -- Used to check if the player is in a position where the radar should be allowed operation @@ -109,10 +113,10 @@ RADAR.vars = ["opp"] = 3, -- The volume of the audible beep - ["beep"] = 1.0, - - -- The volume of the verbal lock confirmation - ["voice"] = 1.0, + ["beep"] = 1.0, + + -- The volume of the verbal lock confirmation + ["voice"] = 1.0, -- The speed unit used in conversions ["speedType"] = "mph" @@ -126,8 +130,8 @@ RADAR.vars = { displayText = { "¦¦¦", "FAS" }, optionsText = { "On¦", "Off" }, options = { true, false }, optionIndex = 1, settingText = "fastDisplay" }, { displayText = { "¦SL", "SEn" }, optionsText = { "¦1¦", "¦2¦", "¦3¦", "¦4¦", "¦5¦" }, options = { 0.2, 0.4, 0.6, 0.8, 1.0 }, optionIndex = 3, settingText = "same" }, { displayText = { "¦OP", "SEn" }, optionsText = { "¦1¦", "¦2¦", "¦3¦", "¦4¦", "¦5¦" }, options = { 0.2, 0.4, 0.6, 0.8, 1.0 }, optionIndex = 3, settingText = "opp" }, - { displayText = { "bEE", "P¦¦" }, optionsText = { "Off", "¦1¦", "¦2¦", "¦3¦", "¦4¦", "¦5¦" }, options = { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 }, optionIndex = 6, settingText = "beep" }, - { displayText = { "VOI", "CE¦" }, optionsText = { "Off", "¦1¦", "¦2¦", "¦3¦", "¦4¦", "¦5¦" }, options = { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 }, optionIndex = 6, settingText = "voice" }, + { displayText = { "bEE", "P¦¦" }, optionsText = { "Off", "¦1¦", "¦2¦", "¦3¦", "¦4¦", "¦5¦" }, options = { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 }, optionIndex = 6, settingText = "beep" }, + { displayText = { "VOI", "CE¦" }, optionsText = { "Off", "¦1¦", "¦2¦", "¦3¦", "¦4¦", "¦5¦" }, options = { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 }, optionIndex = 6, settingText = "voice" }, { displayText = { "Uni", "tS¦" }, optionsText = { "USA", "INT" }, options = { "mph", "kmh" }, optionIndex = 1, settingText = "speedType" } }, @@ -193,10 +197,10 @@ RADAR.vars = -- The wait time for the ray trace system, this changes dynamically based on if the player's vehicle is stationary -- or not - threadWaitTime = 500, - - -- Key lock, when true, prevents any of the radar's key events from working, like the ELS key lock - keyLock = false + threadWaitTime = 500, + + -- Key lock, when true, prevents any of the radar's key events from working, like the ELS key lock + keyLock = false } -- Speed conversion values @@ -411,19 +415,19 @@ end -- Toggles the internal key lock state, which stops any of the radar's key binds from working function RADAR:ToggleKeyLock() - -- Check the player state is valid - if ( PLY:VehicleStateValid() ) then - -- Toggle the key lock variable - self.vars.keyLock = not self.vars.keyLock + -- Check the player state is valid + if ( PLY:VehicleStateValid() ) then + -- Toggle the key lock variable + self.vars.keyLock = not self.vars.keyLock - -- Tell the NUI side to display the key lock message - SendNUIMessage( { _type = "displayKeyLock", state = self:GetKeyLockState() } ) - end + -- Tell the NUI side to display the key lock message + SendNUIMessage( { _type = "displayKeyLock", state = self:GetKeyLockState() } ) + end end -- Returns the key lock state function RADAR:GetKeyLockState() - return self.vars.keyLock + return self.vars.keyLock end @@ -626,12 +630,12 @@ end -- much further away (400+ units). Also, as my system uses sphere intersections, each sphere can have a different -- radius, which means that larger vehicles can have larger spheres, and smaller vehicles can have smaller spheres. function RADAR:GetLineHitsSphereAndDir( c, radius, rs, re ) - -- Take the vector3's and turn them into vector2's, this way all of the calculations below are for an - -- infinite cylinder rather than a sphere, which also means that vehicles can be detected even when on - -- an incline! - local rayStart = vector2( rs.x, rs.y ) - local rayEnd = vector2( re.x, re.y ) - local centre = vector2( c.x, c.y ) + -- Take the vector3's and turn them into vector2's, this way all of the calculations below are for an + -- infinite cylinder rather than a sphere, which also means that vehicles can be detected even when on + -- an incline! + local rayStart = vector2( rs.x, rs.y ) + local rayEnd = vector2( re.x, re.y ) + local centre = vector2( c.x, c.y ) -- First we get the normalised ray, this way we then know the direction the ray is going local rayNorm = norm( rayEnd - rayStart ) @@ -674,7 +678,7 @@ function RADAR:ShootCustomRay( plyVeh, veh, s, e ) -- Calculate the distance between the target vehicle and the start point of the ray trace, note how we don't -- use GetDistanceBetweenCoords or Vdist, the method below still returns the same result with less cpu time - local dist = #( pos - s ) + local dist = #( pos - s ) -- We only perform a trace on the target vehicle if it exists, isn't the player's vehicle, and the distance is -- less than the max distance defined by the system @@ -683,10 +687,10 @@ function RADAR:ShootCustomRay( plyVeh, veh, s, e ) local entSpeed = GetEntitySpeed( veh ) -- Check that the target vehicle is within the line of sight of the player's vehicle - local visible = HasEntityClearLosToEntity( plyVeh, veh, 15 ) -- 13 seems okay, 15 too (doesn't grab ents through ents) - - -- Get the pitch of the player's vehicle - local pitch = GetEntityPitch( plyVeh ) + local visible = HasEntityClearLosToEntity( plyVeh, veh, 15 ) -- 13 seems okay, 15 too (doesn't grab ents through ents) + + -- Get the pitch of the player's vehicle + local pitch = GetEntityPitch( plyVeh ) -- Now we check that the target vehicle is moving and is visible if ( entSpeed > 0.1 and ( pitch > -35 and pitch < 35 ) and visible ) then @@ -928,10 +932,10 @@ function RADAR:SetAntennaSpeedLock( ant, speed, dir, lockType ) self:SetAntennaSpeedIsLocked( ant, true ) -- Send a message to the NUI side to play the beep sound with the current volume setting - SendNUIMessage( { _type = "audio", name = "beep", vol = RADAR:GetSettingValue( "beep" ) } ) - - -- Send a message to the NUI side to play the lock audio with the current voice volume setting - SendNUIMessage( { _type = "lockAudio", ant = ant, dir = dir, vol = RADAR:GetSettingValue( "voice" ) } ) + SendNUIMessage( { _type = "audio", name = "beep", vol = RADAR:GetSettingValue( "beep" ) } ) + + -- Send a message to the NUI side to play the lock audio with the current voice volume setting + SendNUIMessage( { _type = "lockAudio", ant = ant, dir = dir, vol = RADAR:GetSettingValue( "voice" ) } ) end end @@ -966,10 +970,10 @@ end function RADAR:LockAntennaSpeed( ant ) -- Only lock a speed if the antenna is on and the UI is displayed if ( self:IsPowerOn() and self:GetDisplayState() and not self:GetDisplayHidden() and self:IsAntennaTransmitting( ant ) ) then - -- Check if the antenna doesn't have a locked speed, if it doesn't then we lock in the speed, otherwise we - -- reset the lock + -- Check if the antenna doesn't have a locked speed, if it doesn't then we lock in the speed, otherwise we + -- reset the lock if ( not self:IsAntennaSpeedLocked( ant ) ) then - -- Set up a temporary table with 3 nil values, this way if the system isn't able to get a speed or + -- Set up a temporary table with 3 nil values, this way if the system isn't able to get a speed or -- direction, the speed lock function won't work local data = { nil, nil, nil } @@ -986,7 +990,7 @@ function RADAR:LockAntennaSpeed( ant ) end -- Lock in the speed data for the antenna - self:SetAntennaSpeedLock( ant, data[1], data[2], data[3] ) + self:SetAntennaSpeedLock( ant, data[1], data[2], data[3] ) else self:ResetAntennaSpeedLock( ant ) end @@ -1039,8 +1043,8 @@ function RADAR:InsertCapturedVehicleData( t, rt ) end --[[ - These need to be changed so a ray type can be set too, otherwise in its current state, messes up vehicle - detection. + These need to be changed so a ray type can be set too, otherwise in its current state, messes up vehicle + detection. -- Sets the given value to true in the temp vehicles table, it is a test system used to reduce ray traces -- on vehicles that have already been hit by another trace. Currently not implemented fully, as it doesn't @@ -1342,7 +1346,7 @@ end ) -- Runs when the JavaScript side sends the UI data for saving RegisterNUICallback( "saveUiData", function( data, cb ) - TriggerServerEvent( "wk:saveUiData", data ) + TriggerServerEvent( "wk:saveUiData", data ) end ) @@ -1526,15 +1530,21 @@ end -- Main thread Citizen.CreateThread( function() + -- Remove the NUI focus just in case SetNuiFocus( false, false ) + -- Run the function to cache the number of rays, this way a hard coded number is never needed RADAR:CacheNumRays() + + -- Update the end coordinates for the ray traces based on the config, again, reduced hard coding RADAR:UpdateRayEndCoords() + -- If the fast limit feature is allowed, create the config in the radar variables if ( RADAR:IsFastLimitAllowed() ) then RADAR:CreateFastLimitConfig() end + -- Run the main radar function while ( true ) do RADAR:Main() @@ -1542,6 +1552,9 @@ Citizen.CreateThread( function() end end ) +-- This function is pretty much straight from WraithRS, it does the job so I didn't see the point in not +-- using it. Hides the radar UI when certain criteria is met, e.g. in pause menu or stepped out ot the +-- patrol vehicle 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 ) @@ -1552,69 +1565,79 @@ function RADAR:RunDisplayValidationCheck() end end +-- Runs the display validation check for the radar Citizen.CreateThread( function() Citizen.Wait( 100 ) while ( true ) do + -- Run the check RADAR:RunDisplayValidationCheck() + -- Wait half a second Citizen.Wait( 500 ) end end ) -- Update the vehicle pool every 3 seconds function RADAR:UpdateVehiclePool() + -- Only update the vehicle pool if we need to if ( PLY:VehicleStateValid() and self:CanPerformMainTask() and self:IsEitherAntennaOn() ) then + -- Get the active vehicle set local vehs = self:GetAllVehicles() + + -- Update the vehicle pool self:SetVehiclePool( vehs ) end end +-- Runs the vehicle pool updater Citizen.CreateThread( function() while ( true ) do + -- Update the vehicle pool RADAR:UpdateVehiclePool() + -- Wait 3 seconds Citizen.Wait( 3000 ) end end ) function RunControlManager() - if ( not RADAR:GetKeyLockState() ) then - -- Opens the remote control - if ( IsDisabledControlJustPressed( 1, CONFIG.remote_control_key ) ) then - RADAR:OpenRemote() - end + if ( not RADAR:GetKeyLockState() ) then + -- Opens the remote control + if ( IsDisabledControlJustPressed( 1, CONFIG.remote_control_key ) ) then + RADAR:OpenRemote() + end - -- Locks speed from front antenna - if ( IsDisabledControlJustPressed( 1, CONFIG.front_lock_key ) ) then - RADAR:LockAntennaSpeed( "front" ) - end + -- Locks speed from front antenna + if ( IsDisabledControlJustPressed( 1, CONFIG.front_lock_key ) ) then + RADAR:LockAntennaSpeed( "front" ) + end - -- Locks speed from rear antenna - if ( IsDisabledControlJustPressed( 1, CONFIG.rear_lock_key ) ) then - RADAR:LockAntennaSpeed( "rear" ) - end + -- Locks speed from rear antenna + if ( IsDisabledControlJustPressed( 1, CONFIG.rear_lock_key ) ) then + RADAR:LockAntennaSpeed( "rear" ) + end - -- Locks front plate reader - if ( IsDisabledControlJustPressed( 1, CONFIG.plate_front_lock_key ) ) then - READER:LockCam( "front" ) - end + -- Locks front plate reader + if ( IsDisabledControlJustPressed( 1, CONFIG.plate_front_lock_key ) ) then + READER:LockCam( "front" ) + end - -- Locks front plate reader - if ( IsDisabledControlJustPressed( 1, CONFIG.plate_rear_lock_key ) ) then - READER:LockCam( "rear" ) - end - end - - -- Toggles the key lock state - if ( IsDisabledControlJustPressed( 1, CONFIG.key_lock_key ) ) then + -- Locks front plate reader + if ( IsDisabledControlJustPressed( 1, CONFIG.plate_rear_lock_key ) ) then + READER:LockCam( "rear" ) + end + end + + -- Toggles the key lock state + if ( IsDisabledControlJustPressed( 1, CONFIG.key_lock_key ) ) then RADAR:ToggleKeyLock() - end + end -- Shortcut to restart the resource - if ( IsDisabledControlJustPressed( 1, 167 ) ) then + --[[ if ( IsDisabledControlJustPressed( 1, 167 ) ) then ExecuteCommand( "restart wk_wars2x" ) - end + end ]] end -- Control manager diff --git a/cl_utils.lua b/cl_utils.lua index e65fc67..84a9ef8 100644 --- a/cl_utils.lua +++ b/cl_utils.lua @@ -7,33 +7,45 @@ UTIL = {} +-- Returns a number to a set number of decimal places function UTIL:Round( num, numDecimalPlaces ) return tonumber( string.format( "%." .. ( numDecimalPlaces or 0 ) .. "f", num ) ) end +-- The custom font used for the digital displays have the ¦ symbol as an empty character, this function +-- takes a speed and returns a formatted speed that can be displayed on the radar function UTIL:FormatSpeed( speed ) + -- Return "Err" (Error) if the given speed is outside the 0-999 range if ( speed < 0 or speed > 999 ) then return "Err" end + -- Convert the speed to a string local text = tostring( speed ) local pipes = "" + -- Create a string of pipes (¦) for the number of spaces for i = 1, 3 - string.len( text ) do pipes = pipes .. "¦" end + -- Return the formatted speed return pipes .. text end +-- Returns a clamped numerical value based on the given parameters function UTIL:Clamp( val, min, max ) + -- Return the min value if the given value is less than the min if ( val < min ) then return min + -- Return the max value if the given value is larger than the max elseif ( val > max ) then return max end + -- Return the given value if it's between the min and max return val end +-- Returns if the given table is empty, includes numerical and non-numerical key values function UTIL:IsTableEmpty( t ) local c = 0 @@ -52,12 +64,15 @@ function UTIL:Values( xs ) end end +-- Old ray trace function for getting a vehicle in a specific direction from a start point function UTIL:GetVehicleInDirection( entFrom, coordFrom, coordTo ) - 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 ) + local rayHandle = StartShapeTestCapsule( coordFrom.x, coordFrom.y, coordFrom.z, coordTo.x, coordTo.y, coordTo.z, 8.0, 10, entFrom, 7 ) + local _, _, _, _, vehicle = GetShapeTestResult( rayHandle ) return vehicle end +-- Returns if a target vehicle is coming towards or going away from the patrol vehicle, it has a range +-- so if a vehicle is sideways compared to the patrol vehicle, the directional arrows won't light up function UTIL:GetEntityRelativeDirection( myAng, tarAng ) local angleDiff = math.abs( ( myAng - tarAng + 180 ) % 360 - 180 ) @@ -70,6 +85,7 @@ function UTIL:GetEntityRelativeDirection( myAng, tarAng ) return 0 end +-- Your everyday GTA notification function function UTIL:Notify( text ) SetNotificationTextEntry( "STRING" ) AddTextComponentSubstringPlayerName( text ) @@ -91,28 +107,6 @@ function UTIL:DrawDebugText( x, y, scale, centre, text ) DrawText( x, y ) end -function UTIL:DrawDebugSphere( x, y, z, r, col ) - if ( CONFIG.debug_mode ) then - local col = col or { 255, 255, 255, 255 } - - DrawMarker( 28, x, y, z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, r, r, r, col[1], col[2], col[3], col[4], false, true, 2, false, false, false, false ) - end -end - -function UTIL:DrawDebugLine( startP, endP, col ) - if ( CONFIG.debug_mode ) then - local col = col or { 255, 255, 255, 255 } - - DrawLine( startP, endP, col[1], col[2], col[3], col[4] ) - end -end - -function UTIL:DebugPrint( text ) - if ( CONFIG.debug_mode ) then - print( text ) - end -end - --[[The MIT License (MIT) Copyright (c) 2017 IllidanS4 diff --git a/config.lua b/config.lua index 59cb669..ee7510b 100644 --- a/config.lua +++ b/config.lua @@ -8,8 +8,8 @@ -- Do not touch this CONFIG = {} --- Radar Control Panel key --- The default key to open the radar control panel is 166 (F5 - INPUT_SELECT_CHARACTER_MICHAEL) +-- Remote control key +-- The default key to open the remote control is 166 (F5 - INPUT_SELECT_CHARACTER_MICHAEL) CONFIG.remote_control_key = 166 -- Radar front antenna lock/unlock Key diff --git a/nui/radar.css b/nui/radar.css index e5b7bba..af18424 100644 --- a/nui/radar.css +++ b/nui/radar.css @@ -88,7 +88,6 @@ button:focus { outline: none; } width: 675px; height: 200px; - /* Temp centre */ position: absolute; margin: auto; top: 0; @@ -160,8 +159,6 @@ button:focus { outline: none; } grid-template-columns: 45px 50px 150px 35px 50px 135px 35px 135px; gap: 0 0; - /* z-index: 2; */ - box-shadow: inset 0px 20px 20px -15px rgba( 0, 0, 0, 0.4 ); } #radar .label { @@ -194,7 +191,6 @@ button:focus { outline: none; } background: linear-gradient( to bottom, rgba( 230, 230, 230, 0.8 ), rgb( 40, 168, 40 ) 10%, rgb( 0, 134, 0 ) ); box-shadow: 0px 0px 3px 0px rgb( 80, 80, 80 ); text-align: center; - /* font-family: 'Heebo-Regular'; */ font-size: 14px; color: rgb( 34, 34, 34 ); line-height: 45px; @@ -372,20 +368,13 @@ button:focus { outline: none; } } #rc { - /* width: 275px; - height: 750px; */ width: 315px; height: 800px; position: absolute; - /* top: 0; - bottom: 0; - left: 0; - right: 0; */ top: calc( 50% - ( 800px / 2 ) ); left: calc( 50% - ( 315px / 2 ) ); margin: auto; - /* padding-top: 25px; */ padding: 65px 30px 50px 30px; display: grid; @@ -394,12 +383,9 @@ button:focus { outline: none; } align-items: center; color: white; - /* background-color: rgb( 50, 50, 50 ); */ background-image: url( "images/rc_bg.png" ); transition: transform 0.5s; - - /* clip-path: polygon( 5% 0, 95% 0, 100% 25%, 90% 100%, 10% 100%, 0 25% ); */ /* Settings for scaling */ transform: scale( 1.0 ); @@ -414,8 +400,6 @@ button:focus { outline: none; } padding: 0; background-color: rgb( 200, 200, 200 ); - - /* font-family: 'Heebo-Regular'; */ box-shadow: 2px 3px rgb( 100, 100, 100 ); } @@ -495,10 +479,8 @@ button:focus { outline: none; } } #rc .label { - /* font-family: 'Heebo-Regular'; */ font-size: 20px; letter-spacing: 1px; - /* margin: 5px 0; */ } #rc .antenna_btns_container { @@ -625,9 +607,6 @@ button:focus { outline: none; } 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 ); */ - z-index: 1; } #plateReaderFrame .frame_border { @@ -644,8 +623,6 @@ button:focus { outline: none; } 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 { @@ -721,7 +698,6 @@ button:focus { outline: none; } font-size: 58px; text-align: center; letter-spacing: -3px; - /* color: rgb(0, 0, 163); */ padding-top: 5px; margin: 0; grid-column: 1; @@ -754,11 +730,9 @@ button:focus { outline: none; } bottom: 0; left: 0; - /* background-color: rgb( 50, 54, 45 ); */ background: linear-gradient( to bottom, rgb( 70, 70, 70 ), rgb( 45, 45, 45 ) ); border: 3px solid rgb( 0, 0, 0 ); - /* for testing */ z-index: 4; } #plateReaderBox .title { @@ -805,10 +779,10 @@ button:focus { outline: none; } font-family: "Plate-Font"; text-align: center; font-size: 38px; + text-transform: uppercase; padding: 0; padding-bottom: 15px; margin-bottom: -15px; - /* border: 3px solid rgb( 0, 0, 0 ); */ } #plateReaderBox .close { @@ -843,9 +817,8 @@ button:focus { outline: none; } top: 0; right: 0; bottom: 0; - left: 0; - - /* background-color: rgb( 50, 54, 45 ); */ + left: 0; + background: linear-gradient( to bottom, rgb( 70, 70, 70 ), rgb( 45, 45, 45 ) ); border: 3px solid rgb( 0, 0, 0 ); @@ -872,10 +845,6 @@ button:focus { outline: none; } #uiSettingsBox .scaling { height: 70px; - - /* display: flex; - justify-content: space-evenly; - align-items: center; */ display: grid; grid-template-columns: 1fr 2fr 1fr; diff --git a/nui/radar.html b/nui/radar.html index b628418..0fbe564 100644 --- a/nui/radar.html +++ b/nui/radar.html @@ -16,7 +16,7 @@