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:
11
cl_radar.lua
11
cl_radar.lua
@@ -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
|
-- Returns if the player can run radar, ensures their vehicle state is valid and that they are a driver or
|
||||||
-- a passenger (where valid)
|
-- a passenger (where valid)
|
||||||
function PLY:CanRunRadar()
|
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
|
end
|
||||||
|
|
||||||
-- Returns if the player is allowed to control the radar from the passenger seat
|
-- Returns if the player is allowed to control the radar from the passenger seat
|
||||||
function PLY:CanControlRadar()
|
function PLY:CanControlRadar()
|
||||||
return self:VehicleStateValid() and self:IsPassenger() and RADAR:IsPassengerControlAllowed()
|
return self:IsPassenger() and RADAR:IsPassengerControlAllowed()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- The main purpose of this thread is to update the information about the local player, including their
|
-- 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
|
-- Runs when the user presses the power button on the radar ui
|
||||||
RegisterNUICallback( "togglePower", function( data, cb )
|
RegisterNUICallback( "togglePower", function( data, cb )
|
||||||
-- Toggle the radar's power
|
if ( PLY:IsDriver() or ( PLY:IsPassenger() and RADAR:IsPassengerControlAllowed() ) ) then
|
||||||
RADAR:TogglePower()
|
-- Toggle the radar's power
|
||||||
|
RADAR:TogglePower()
|
||||||
|
end
|
||||||
|
|
||||||
cb( "ok" )
|
cb( "ok" )
|
||||||
end )
|
end )
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user