Added config option to only auto lock speeds if it's a player

This commit is contained in:
Dan
2021-01-07 10:50:52 +00:00
parent 47fa80d67b
commit a166dda1cb
3 changed files with 27 additions and 3 deletions

View File

@@ -531,6 +531,11 @@ function RADAR:IsPassengerControlAllowed()
return CONFIG.allow_passenger_view and CONFIG.allow_passenger_control
end
-- Returns if we only auto lock vehicle speeds if said vehicle is a player
function RADAR:OnlyLockFastPlayers()
return CONFIG.only_lock_players
end
-- Returns if the fast limit option should be available for the radar
function RADAR:IsFastLimitAllowed()
return CONFIG.allow_fast_limit
@@ -1799,7 +1804,9 @@ function RADAR:Main()
if ( self:IsFastLimitAllowed() ) then
-- Make sure the speed is larger than the limit, and that there isn't already a locked speed
if ( self:IsFastLockEnabled() and convertedSpeed > self:GetFastLimit() and not self:IsAntennaSpeedLocked( ant ) ) then
self:LockAntennaSpeed( ant )
if ( ( self:OnlyLockFastPlayers() and UTIL:IsPlayerInVeh( av[ant][i].veh ) ) or not self:OnlyLockFastPlayers() ) then
self:LockAntennaSpeed( ant )
end
end
end
else

View File

@@ -111,6 +111,19 @@ function UTIL:GetEntityRelativeDirection( myAng, tarAng )
return 0
end
-- Returns if there is a player in the given vehicle
function UTIL:IsPlayerInVeh( veh )
for i = -1, GetVehicleMaxNumberOfPassengers( veh ) + 1, 1 do
local ped = GetPedInVehicleSeat( veh, i )
if ( DoesEntityExist( ped ) ) then
if ( IsPedAPlayer( ped ) ) then return true end
end
end
return false
end
-- Your everyday GTA notification function
function UTIL:Notify( text )
SetNotificationTextEntry( "STRING" )

View File

@@ -39,7 +39,11 @@ CONFIG.debug = true
-- Radar fast limit locking
-- When enabled, the player will be able to define a fast limit within the radar's menu, when a vehicle
-- exceeds the fast limit, it will be locked into the fast box. Default setting is disabled to maintain realism
CONFIG.allow_fast_limit = false
CONFIG.allow_fast_limit = true
-- Radar only lock playersw with auto fast locking
-- When enabled, the radar will only automatically lock a speed if the caught vehicle has a real player in it.
CONFIG.only_lock_players = false
-- In-game first time quick start video
-- When enabled, the player will be asked if they'd like to view the quick start video the first time they
@@ -47,7 +51,7 @@ CONFIG.allow_fast_limit = false
CONFIG.allow_quick_start_video = true
-- Allow passenger view
-- When enabled, the front seat passenger will be able to view the radar and plate reader from their end
-- When enabled, the front seat passenger will be able to view the radar and plate reader from their end.
CONFIG.allow_passenger_view = true
-- Allow passenger control