Can't turn on radar power as the passenger

If CONFIG.allow_passenger_control is set to true, then the passenger can turn on the power.
This commit is contained in:
Dan
2020-11-13 19:35:00 +00:00
parent e5aeb844d7
commit 964f97835b

View File

@@ -181,12 +181,12 @@ end
-- Returns if the player can run radar, ensures their vehicle state is valid and that they are a driver or
-- a passenger (where valid)
function PLY:CanRunRadar()
return self:VehicleStateValid() and ( self:IsDriver() or ( self:IsPassenger() and RADAR:IsPassengerViewAllowed() ) )
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:VehicleStateValid() and self:IsPassenger() and RADAR:IsPassengerControlAllowed()
return self:IsPassenger() and RADAR:IsPassengerControlAllowed()
end
-- The main purpose of this thread is to update the information about the local player, including their
@@ -1527,8 +1527,11 @@ 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
-- Toggle the radar's power
RADAR:TogglePower()
end
cb( "ok" )
end )