diff --git a/cl_radar.lua b/cl_radar.lua index 8c83eab..a3e140c 100644 --- a/cl_radar.lua +++ b/cl_radar.lua @@ -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 diff --git a/cl_utils.lua b/cl_utils.lua index 7e8c942..385ea54 100644 --- a/cl_utils.lua +++ b/cl_utils.lua @@ -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" ) diff --git a/config.lua b/config.lua index e77abfb..ea81ddb 100644 --- a/config.lua +++ b/config.lua @@ -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