diff --git a/cl_plate_reader.lua b/cl_plate_reader.lua index 896897a..c83e1c8 100644 --- a/cl_plate_reader.lua +++ b/cl_plate_reader.lua @@ -104,14 +104,14 @@ function READER:GetCamLocked( cam ) end -- Locks the given reader -function READER:LockCam( cam, playAudio ) +function READER:LockCam( cam, playAudio, isBolo ) -- 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 ) } ) + SendNUIMessage( { _type = "lockPlate", cam = cam, state = self:GetCamLocked( cam ), isBolo = isBolo } ) -- Play a beep if ( self:GetCamLocked( cam ) ) then @@ -199,7 +199,7 @@ function READER:Main() -- Automatically lock the plate if the scanned plate matches the BOLO if ( plate == self:GetBoloPlate() ) then - self:LockCam( cam, false ) + self:LockCam( cam, false, true ) SendNUIMessage( { _type = "audio", name = "plate_hit", vol = RADAR:GetSettingValue( "plateAudio" ) } ) end diff --git a/cl_radar.lua b/cl_radar.lua index 6ca8003..7d556f6 100644 --- a/cl_radar.lua +++ b/cl_radar.lua @@ -204,7 +204,11 @@ RADAR.vars = threadWaitTime = 500, -- Key lock, when true, prevents any of the radar's key events from working, like the ELS key lock - keyLock = false + keyLock = false, + + -- Full keyboard, when true, the keybinds for the radar will be set to the keys on the numpad, when false, the + -- keybinds for the radar will be set to the number keys above WASD + fullKeyboard = true } -- Speed conversion values @@ -434,6 +438,32 @@ function RADAR:GetKeyLockState() return self.vars.keyLock end +-- Toggles between the full and small keybinds +function RADAR:ToggleFullKeyboard() + -- Check the player state is valid + if ( PLY:VehicleStateValid() ) then + -- Toggle the full keyboard state + self.vars.fullKeyboard = not self.vars.fullKeyboard + + -- Tell the NUI side to display the keybind message + SendNUIMessage( { _type = "displayKeybindChange", state = self:GetFullKeyboardState() } ) + end +end + +-- Returns the full keyboard state +function RADAR:GetFullKeyboardState() + return self.vars.fullKeyboard +end + +-- Returns which keybind set to use +function RADAR:GetKeybindType() + if ( self:GetFullKeyboardState() ) then + return "full" + else + return "small" + end +end + --[[---------------------------------------------------------------------------------- Radar menu functions @@ -1611,37 +1641,44 @@ end ) function RunControlManager() -- Make sure only the keyboard works if ( IsInputDisabled( 0 ) ) then - if ( not RADAR:GetKeyLockState() ) then + if ( not RADAR:GetKeyLockState() ) then + local keyType = RADAR:GetKeybindType() + -- Opens the remote control - if ( IsDisabledControlJustPressed( 1, CONFIG.remote_control_key ) ) then + if ( IsDisabledControlJustPressed( 1, CONFIG.keys.remote_control ) ) then RADAR:OpenRemote() end -- Locks speed from front antenna - if ( IsDisabledControlJustPressed( 1, CONFIG.front_lock_key ) ) then + if ( IsDisabledControlJustPressed( 1, CONFIG.keys[keyType].front_lock ) ) then RADAR:LockAntennaSpeed( "front" ) end -- Locks speed from rear antenna - if ( IsDisabledControlJustPressed( 1, CONFIG.rear_lock_key ) ) then + if ( IsDisabledControlJustPressed( 1, CONFIG.keys[keyType].rear_lock ) ) then RADAR:LockAntennaSpeed( "rear" ) end -- Locks front plate reader - if ( IsDisabledControlJustPressed( 1, CONFIG.plate_front_lock_key ) ) then - READER:LockCam( "front", true ) + if ( IsDisabledControlJustPressed( 1, CONFIG.keys[keyType].plate_front_lock ) ) then + READER:LockCam( "front", true, false ) end -- Locks front plate reader - if ( IsDisabledControlJustPressed( 1, CONFIG.plate_rear_lock_key ) ) then - READER:LockCam( "rear", true ) + if ( IsDisabledControlJustPressed( 1, CONFIG.keys[keyType].plate_rear_lock ) ) then + READER:LockCam( "rear", true, false ) end end -- Toggles the key lock state - if ( IsDisabledControlJustPressed( 1, CONFIG.key_lock_key ) ) then + if ( IsDisabledControlJustPressed( 1, CONFIG.keys.key_lock ) ) then RADAR:ToggleKeyLock() - end + end + + -- Toggles between the keybind types + if ( IsDisabledControlJustPressed( 1, CONFIG.keys.switch_keys ) ) then + RADAR:ToggleFullKeyboard() + end end -- Shortcut to restart the resource diff --git a/config.lua b/config.lua index ee7510b..6159544 100644 --- a/config.lua +++ b/config.lua @@ -8,29 +8,58 @@ -- Do not touch this CONFIG = {} --- Remote control key --- The default key to open the remote control is 166 (F5 - INPUT_SELECT_CHARACTER_MICHAEL) -CONFIG.remote_control_key = 166 +CONFIG.keys = +{ + -- Remote control key + -- The default key to open the remote control is 166 (F5 - INPUT_SELECT_CHARACTER_MICHAEL) + remote_control = 166, --- Radar front antenna lock/unlock Key --- The default key to lock/unlock the front antenna is 111 (Numpad 8 - INPUT_VEH_FLY_PITCH_UP_ONLY) -CONFIG.front_lock_key = 111 + -- Radar key lock key + -- The default key to enable/disable the radar key lock is 182 (L - INPUT_CELLPHONE_CAMERA_FOCUS_LOCK) + key_lock = 182, --- Radar rear antenna lock/unlock Key --- The default key to lock/unlock the rear antenna is 112 (Numpad 5 - INPUT_VEH_FLY_PITCH_DOWN_ONLY) -CONFIG.rear_lock_key = 112 + -- Radar keybinds switch + -- The default to key to switch the bind set is (K - INPUT_REPLAY_SHOWHOTKEY) + switch_keys = 311, --- Radar key lock key --- The default key to enable/disable the radar key lock is 311 (K - INPUT_REPLAY_SHOWHOTKEY) -CONFIG.key_lock_key = 311 + -- Keys for a full size keyboard + [ "full" ] = { + -- Radar front antenna lock/unlock Key + -- The default full keyboard key to lock/unlock the front antenna is 111 (Numpad 8 - INPUT_VEH_FLY_PITCH_UP_ONLY) + front_lock = 111, --- Plate reader front lock/unlock Key --- The default key to lock/unlock the front plate reader is 118 (Numpad 9 - INPUT_VEH_FLY_SELECT_TARGET_RIGHT) -CONFIG.plate_front_lock_key = 118 + -- Radar rear antenna lock/unlock Key + -- The default full keyboard key to lock/unlock the rear antenna is 112 (Numpad 5 - INPUT_VEH_FLY_PITCH_DOWN_ONLY) + rear_lock = 112, --- Plate reader rear lock/unlock Key --- The default key to lock/unlock the rear plate reader is 109 (Numpad 6 - INPUT_VEH_FLY_ROLL_RIGHT_ONLY) -CONFIG.plate_rear_lock_key = 109 + -- Plate reader front lock/unlock Key + -- The default full keyboard key to lock/unlock the front plate reader is 118 (Numpad 9 - INPUT_VEH_FLY_SELECT_TARGET_RIGHT) + plate_front_lock = 118, + + -- Plate reader rear lock/unlock Key + -- The default full keyboard key to lock/unlock the rear plate reader is 109 (Numpad 6 - INPUT_VEH_FLY_ROLL_RIGHT_ONLY) + plate_rear_lock = 109 + }, + + -- Keys for smaller keyboards + [ "small" ] = { + -- Radar front antenna lock/unlock Key + -- The default small keyboard key to lock/unlock the front antenna is 157 (1 - INPUT_SELECT_WEAPON_UNARMED) + front_lock = 157, + + -- Radar rear antenna lock/unlock Key + -- The default small keyboard key to lock/unlock the rear antenna is 158 (2 - INPUT_SELECT_WEAPON_MELEE) + rear_lock = 158, + + -- Plate reader front lock/unlock Key + -- The default small keyboard key to lock/unlock the front plate reader is 160 (3 - INPUT_SELECT_WEAPON_SHOTGUN) + plate_front_lock = 160, + + -- Plate reader rear lock/unlock Key + -- The default small keyboard key to lock/unlock the rear plate reader is 164 (4 - INPUT_SELECT_WEAPON_HEAVY) + plate_rear_lock = 164 + } +} -- Radar fast limit locking -- When enabled, the player will be able to define a fast limit within the radar's menu, when a vehicle diff --git a/nui/radar.css b/nui/radar.css index 519f6da..723cd4e 100644 --- a/nui/radar.css +++ b/nui/radar.css @@ -958,7 +958,7 @@ button:focus { outline: none; } padding: 0; } -#keyLockLabel { +#keyLockLabel, #keyBindsLabel { position: absolute; left: 0; right: 0; @@ -967,12 +967,12 @@ button:focus { outline: none; } text-align: center; font-size: 30px; - color: rgb( 200, 200, 200 ); + color: rgb(255, 255, 255); text-shadow: 3px 2px 5px rgb( 0, 0, 0 ); z-index: 5; } - #keyLockLabel span { + #keyLockLabel span, #keyBindsLabel span { font-size: 30px; } diff --git a/nui/radar.html b/nui/radar.html index bec5011..6a24aad 100644 --- a/nui/radar.html +++ b/nui/radar.html @@ -268,6 +268,8 @@
Radar key lock
+Radar keybinds set for a
+