diff --git a/cl_plate_reader.lua b/cl_plate_reader.lua index e0df2a2..182ff83 100644 --- a/cl_plate_reader.lua +++ b/cl_plate_reader.lua @@ -284,7 +284,7 @@ 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 ) SendNUIMessage( { _type = "setReaderDisplayState", state = false } ) - elseif ( PLY:CanRunRadar() and self:GetDisplayState() and self:GetDisplayHidden() ) then + elseif ( PLY:CanViewRadar() and self:GetDisplayState() and self:GetDisplayHidden() ) then self:SetDisplayHidden( false ) SendNUIMessage( { _type = "setReaderDisplayState", state = true } ) end diff --git a/cl_radar.lua b/cl_radar.lua index 60bde48..2a75aa6 100644 --- a/cl_radar.lua +++ b/cl_radar.lua @@ -178,15 +178,15 @@ function PLY:IsPassenger() return self:VehicleStateValid() and self.inPassengerSeat end --- Returns if the player can run radar, ensures their vehicle state is valid and that they are a driver or +-- Returns if the player can view the radar, ensures their vehicle state is valid and that they are a driver or -- a passenger (where valid) -function PLY:CanRunRadar() +function PLY:CanViewRadar() return self:IsDriver() or ( self:IsPassenger() and RADAR:IsPassengerViewAllowed() ) end -- Returns if the player is allowed to control the radar from the passenger seat function PLY:CanControlRadar() - return self:IsPassenger() and RADAR:IsPassengerControlAllowed() + return self:IsDriver() or ( self:IsPassenger() and RADAR:IsPassengerControlAllowed() ) end -- The main purpose of this thread is to update the information about the local player, including their @@ -496,7 +496,7 @@ end -- Opens the remote only if the pause menu is not open and the player's vehicle state is valid, as the -- passenger can also open the remote, we check the config variable as well. function RADAR:OpenRemote() - if ( not IsPauseMenuActive() and PLY:CanRunRadar() ) then + if ( not IsPauseMenuActive() and PLY:CanViewRadar() ) then -- Tell the NUI side to open the remote SendNUIMessage( { _type = "openRemote" } ) @@ -578,7 +578,7 @@ 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:CanRunRadar() ) then + if ( PLY:CanViewRadar() ) then -- Toggle the key lock variable self.vars.keyLock = not self.vars.keyLock @@ -1527,7 +1527,7 @@ end ) -- Runs when the user presses the power button on the radar ui RegisterNUICallback( "togglePower", function( data, cb ) - if ( PLY:IsDriver() or ( PLY:IsPassenger() and RADAR:IsPassengerControlAllowed() ) ) then + if ( PLY:CanControlRadar() ) then -- Toggle the radar's power RADAR:TogglePower() end @@ -1679,7 +1679,7 @@ end ) function RADAR:RunThreads() -- For the system to even run, the player needs to be sat in the driver's seat of a class 18 vehicle, the -- radar has to be visible and the power must be on, and either one of the antennas must be enabled. - if ( PLY:CanRunRadar() and self:CanPerformMainTask() and self:IsEitherAntennaOn() ) then + if ( PLY:CanViewRadar() and self:CanPerformMainTask() and self:IsEitherAntennaOn() ) then -- Before we create any of the custom ray trace threads, we need to make sure that the ray trace state -- is at zero, if it is not at zero, then it means the system is still currently tracing if ( self:GetRayTraceState() == 0 ) then @@ -1721,7 +1721,7 @@ end ) function RADAR:Main() -- Only run any of the main code if all of the states are met, player in the driver's seat of a class 18 vehicle, and -- the system has to be able to perform main tasks - if ( PLY:CanRunRadar() and self:CanPerformMainTask() ) then + if ( PLY:CanViewRadar() and self:CanPerformMainTask() ) then -- Create a table that will be used to store all of the data to be sent to the NUI side local data = {} @@ -1848,7 +1848,7 @@ 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 = "setRadarDisplayState", state = false } ) - elseif ( PLY:CanRunRadar() and self:GetDisplayState() and self:GetDisplayHidden() ) then + elseif ( PLY:CanViewRadar() and self:GetDisplayState() and self:GetDisplayHidden() ) then self:SetDisplayHidden( false ) SendNUIMessage( { _type = "setRadarDisplayState", state = true } ) end @@ -1870,7 +1870,7 @@ end ) -- Update the vehicle pool every 3 seconds function RADAR:UpdateVehiclePool() -- Only update the vehicle pool if we need to - if ( PLY:CanRunRadar() and self:CanPerformMainTask() and self:IsEitherAntennaOn() ) then + if ( PLY:CanViewRadar() and self:CanPerformMainTask() and self:IsEitherAntennaOn() ) then -- Get the active vehicle set local vehs = self:GetAllVehicles()