mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 08:26:27 +02:00
Added in key lock
This commit is contained in:
@@ -10,7 +10,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
|
||||
name 'Wraith ARS 2X'
|
||||
description 'An advanced radar system for FiveM'
|
||||
author 'WolfKnight'
|
||||
version 'beta2d'
|
||||
version 'beta2e'
|
||||
|
||||
files {
|
||||
"nui/radar.html",
|
||||
|
||||
50
cl_radar.lua
50
cl_radar.lua
@@ -178,7 +178,10 @@ RADAR.vars =
|
||||
|
||||
-- The wait time for the ray trace system, this changes dynamically based on if the player's vehicle is stationary
|
||||
-- or not
|
||||
threadWaitTime = 500
|
||||
threadWaitTime = 500,
|
||||
|
||||
-- Key lock, when true, prevents any of the radar's key events from working, like the ELS key lock
|
||||
keyLock = false
|
||||
}
|
||||
|
||||
-- Speed conversion values
|
||||
@@ -391,6 +394,18 @@ if ( RADAR:IsFastLimitAllowed() ) then
|
||||
end
|
||||
end
|
||||
|
||||
function RADAR:ToggleKeyLock()
|
||||
if ( PLY:VehicleStateValid() ) then
|
||||
self.vars.keyLock = not self.vars.keyLock
|
||||
|
||||
SendNUIMessage( { _type = "displayKeyLock" } )
|
||||
end
|
||||
end
|
||||
|
||||
function RADAR:GetKeyLockState()
|
||||
return self.vars.keyLock
|
||||
end
|
||||
|
||||
|
||||
--[[----------------------------------------------------------------------------------
|
||||
Radar menu functions
|
||||
@@ -1536,21 +1551,28 @@ function RADAR:RunControlManager()
|
||||
--[[ if ( IsDisabledControlJustPressed( 1, 20 ) ) then
|
||||
self.config.debug_mode = not self.config.debug_mode
|
||||
end ]]
|
||||
|
||||
-- Opens the remote control
|
||||
if ( IsDisabledControlJustPressed( 1, self.config.remote_control_key ) ) then
|
||||
self:OpenRemote()
|
||||
end
|
||||
|
||||
if ( not self:GetKeyLockState() ) then
|
||||
-- Opens the remote control
|
||||
if ( IsDisabledControlJustPressed( 1, self.config.remote_control_key ) ) then
|
||||
self:OpenRemote()
|
||||
end
|
||||
|
||||
-- Locks speed from front antenna
|
||||
if ( IsDisabledControlJustPressed( 1, self.config.front_lock_key ) ) then
|
||||
self:LockAntennaSpeed( "front" )
|
||||
end
|
||||
-- Locks speed from front antenna
|
||||
if ( IsDisabledControlJustPressed( 1, self.config.front_lock_key ) ) then
|
||||
self:LockAntennaSpeed( "front" )
|
||||
end
|
||||
|
||||
-- Locks speed from rear antenna
|
||||
if ( IsDisabledControlJustPressed( 1, self.config.rear_lock_key ) ) then
|
||||
self:LockAntennaSpeed( "rear" )
|
||||
end
|
||||
-- Locks speed from rear antenna
|
||||
if ( IsDisabledControlJustPressed( 1, self.config.rear_lock_key ) ) then
|
||||
self:LockAntennaSpeed( "rear" )
|
||||
end
|
||||
end
|
||||
|
||||
-- Toggles the key lock state
|
||||
if ( IsDisabledControlJustPressed( 1, self.config.key_lock_key ) ) then
|
||||
self:ToggleKeyLock()
|
||||
end
|
||||
|
||||
-- Shortcut to restart the resource
|
||||
--[[if ( IsDisabledControlJustPressed( 1, 167 ) ) then
|
||||
|
||||
@@ -21,6 +21,10 @@ RADAR.config.front_lock_key = 111
|
||||
-- The default key to lock/unlock the rear antenna is 112 (Numpad 5 - INPUT_VEH_FLY_PITCH_DOWN_ONLY)
|
||||
RADAR.config.rear_lock_key = 112
|
||||
|
||||
-- Radar key lock key
|
||||
-- The default key to enable/disable the radar key lock is 311 (K - INPUT_REPLAY_SHOWHOTKEY)
|
||||
RADAR.config.key_lock_key = 311
|
||||
|
||||
-- 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
|
||||
|
||||
@@ -1 +1 @@
|
||||
beta2d
|
||||
beta2e
|
||||
@@ -765,4 +765,19 @@ button:focus { outline: none; }
|
||||
#uiSettingsBox .close:active {
|
||||
background-color: rgb( 190, 190, 190 );
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
#keyLockLabel {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 300px;
|
||||
|
||||
text-align: center;
|
||||
font-size: 30px;
|
||||
|
||||
color: rgb( 200, 200, 200 );
|
||||
text-shadow: 3px 2px 5px rgb( 0, 0, 0 );
|
||||
|
||||
z-index: 4;
|
||||
}
|
||||
@@ -232,7 +232,9 @@
|
||||
</div>
|
||||
|
||||
<button id="closeUiSettings" class="close">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p id="keyLockLabel">Radar key lock toggled</p>
|
||||
|
||||
<!-- Load JavaScript files -->
|
||||
<script src="nui://game/ui/jquery.js"></script>
|
||||
|
||||
17
nui/radar.js
17
nui/radar.js
@@ -56,7 +56,9 @@ const elements =
|
||||
increase: $( "#increaseScale" ),
|
||||
decrease: $( "#decreaseScale" ),
|
||||
display: $( "#scaleDisplay" )
|
||||
},
|
||||
},
|
||||
|
||||
keyLock: $( "#keyLockLabel" ),
|
||||
|
||||
patrolSpeed: $( "#patrolSpeed" ),
|
||||
|
||||
@@ -128,6 +130,7 @@ const dirs =
|
||||
elements.radar.hide();
|
||||
elements.remote.hide();
|
||||
elements.uiSettingsBox.hide();
|
||||
elements.keyLock.hide();
|
||||
|
||||
elements.uiSettingsBtn.click( function() {
|
||||
setUISettingsVisible( true, true );
|
||||
@@ -320,6 +323,15 @@ function settingUpdate( ants )
|
||||
}
|
||||
}
|
||||
|
||||
function displayKeyLock()
|
||||
{
|
||||
elements.keyLock.fadeIn();
|
||||
|
||||
setTimeout( function() {
|
||||
elements.keyLock.fadeOut();
|
||||
}, 2000 );
|
||||
}
|
||||
|
||||
function playAudio( name, vol )
|
||||
{
|
||||
let audio = new Audio( "sounds/" + audioNames[name] );
|
||||
@@ -480,6 +492,9 @@ window.addEventListener( "message", function( event ) {
|
||||
break;
|
||||
case "lockAudio":
|
||||
playLockAudio( item.ant, item.dir, item.vol );
|
||||
break;
|
||||
case "displayKeyLock":
|
||||
displayKeyLock();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user