mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 00:16:27 +02:00
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:
@@ -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 )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user