mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 08:26:27 +02:00
Added config option to only auto lock speeds if it's a player
This commit is contained in:
@@ -531,6 +531,11 @@ function RADAR:IsPassengerControlAllowed()
|
|||||||
return CONFIG.allow_passenger_view and CONFIG.allow_passenger_control
|
return CONFIG.allow_passenger_view and CONFIG.allow_passenger_control
|
||||||
end
|
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
|
-- Returns if the fast limit option should be available for the radar
|
||||||
function RADAR:IsFastLimitAllowed()
|
function RADAR:IsFastLimitAllowed()
|
||||||
return CONFIG.allow_fast_limit
|
return CONFIG.allow_fast_limit
|
||||||
@@ -1799,9 +1804,11 @@ function RADAR:Main()
|
|||||||
if ( self:IsFastLimitAllowed() ) then
|
if ( self:IsFastLimitAllowed() ) then
|
||||||
-- Make sure the speed is larger than the limit, and that there isn't already a locked speed
|
-- 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
|
if ( self:IsFastLockEnabled() and convertedSpeed > self:GetFastLimit() and not self:IsAntennaSpeedLocked( ant ) ) then
|
||||||
|
if ( ( self:OnlyLockFastPlayers() and UTIL:IsPlayerInVeh( av[ant][i].veh ) ) or not self:OnlyLockFastPlayers() ) then
|
||||||
self:LockAntennaSpeed( ant )
|
self:LockAntennaSpeed( ant )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
-- If the active vehicle is not valid, we reset the internal data
|
-- If the active vehicle is not valid, we reset the internal data
|
||||||
if ( i % 2 == 0 ) then
|
if ( i % 2 == 0 ) then
|
||||||
|
|||||||
13
cl_utils.lua
13
cl_utils.lua
@@ -111,6 +111,19 @@ function UTIL:GetEntityRelativeDirection( myAng, tarAng )
|
|||||||
return 0
|
return 0
|
||||||
end
|
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
|
-- Your everyday GTA notification function
|
||||||
function UTIL:Notify( text )
|
function UTIL:Notify( text )
|
||||||
SetNotificationTextEntry( "STRING" )
|
SetNotificationTextEntry( "STRING" )
|
||||||
|
|||||||
@@ -39,7 +39,11 @@ CONFIG.debug = true
|
|||||||
-- Radar fast limit locking
|
-- Radar fast limit locking
|
||||||
-- When enabled, the player will be able to define a fast limit within the radar's menu, when a vehicle
|
-- 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
|
-- 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
|
-- 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
|
-- 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
|
CONFIG.allow_quick_start_video = true
|
||||||
|
|
||||||
-- Allow passenger view
|
-- 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
|
CONFIG.allow_passenger_view = true
|
||||||
|
|
||||||
-- Allow passenger control
|
-- Allow passenger control
|
||||||
|
|||||||
Reference in New Issue
Block a user