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'
|
name 'Wraith ARS 2X'
|
||||||
description 'An advanced radar system for FiveM'
|
description 'An advanced radar system for FiveM'
|
||||||
author 'WolfKnight'
|
author 'WolfKnight'
|
||||||
version 'beta2d'
|
version 'beta2e'
|
||||||
|
|
||||||
files {
|
files {
|
||||||
"nui/radar.html",
|
"nui/radar.html",
|
||||||
|
|||||||
48
cl_radar.lua
48
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
|
-- The wait time for the ray trace system, this changes dynamically based on if the player's vehicle is stationary
|
||||||
-- or not
|
-- 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
|
-- Speed conversion values
|
||||||
@@ -391,6 +394,18 @@ if ( RADAR:IsFastLimitAllowed() ) then
|
|||||||
end
|
end
|
||||||
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
|
Radar menu functions
|
||||||
@@ -1537,20 +1552,27 @@ function RADAR:RunControlManager()
|
|||||||
self.config.debug_mode = not self.config.debug_mode
|
self.config.debug_mode = not self.config.debug_mode
|
||||||
end ]]
|
end ]]
|
||||||
|
|
||||||
-- Opens the remote control
|
if ( not self:GetKeyLockState() ) then
|
||||||
if ( IsDisabledControlJustPressed( 1, self.config.remote_control_key ) ) then
|
-- Opens the remote control
|
||||||
self:OpenRemote()
|
if ( IsDisabledControlJustPressed( 1, self.config.remote_control_key ) ) then
|
||||||
end
|
self:OpenRemote()
|
||||||
|
end
|
||||||
|
|
||||||
-- Locks speed from front antenna
|
-- Locks speed from front antenna
|
||||||
if ( IsDisabledControlJustPressed( 1, self.config.front_lock_key ) ) then
|
if ( IsDisabledControlJustPressed( 1, self.config.front_lock_key ) ) then
|
||||||
self:LockAntennaSpeed( "front" )
|
self:LockAntennaSpeed( "front" )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Locks speed from rear antenna
|
-- Locks speed from rear antenna
|
||||||
if ( IsDisabledControlJustPressed( 1, self.config.rear_lock_key ) ) then
|
if ( IsDisabledControlJustPressed( 1, self.config.rear_lock_key ) ) then
|
||||||
self:LockAntennaSpeed( "rear" )
|
self:LockAntennaSpeed( "rear" )
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Toggles the key lock state
|
||||||
|
if ( IsDisabledControlJustPressed( 1, self.config.key_lock_key ) ) then
|
||||||
|
self:ToggleKeyLock()
|
||||||
|
end
|
||||||
|
|
||||||
-- Shortcut to restart the resource
|
-- Shortcut to restart the resource
|
||||||
--[[if ( IsDisabledControlJustPressed( 1, 167 ) ) then
|
--[[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)
|
-- 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.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
|
-- 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
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
beta2d
|
beta2e
|
||||||
@@ -765,4 +765,19 @@ button:focus { outline: none; }
|
|||||||
#uiSettingsBox .close:active {
|
#uiSettingsBox .close:active {
|
||||||
background-color: rgb( 190, 190, 190 );
|
background-color: rgb( 190, 190, 190 );
|
||||||
padding: 0;
|
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>
|
</div>
|
||||||
|
|
||||||
<button id="closeUiSettings" class="close">CLOSE</button>
|
<button id="closeUiSettings" class="close">CLOSE</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p id="keyLockLabel">Radar key lock toggled</p>
|
||||||
|
|
||||||
<!-- Load JavaScript files -->
|
<!-- Load JavaScript files -->
|
||||||
<script src="nui://game/ui/jquery.js"></script>
|
<script src="nui://game/ui/jquery.js"></script>
|
||||||
|
|||||||
17
nui/radar.js
17
nui/radar.js
@@ -56,7 +56,9 @@ const elements =
|
|||||||
increase: $( "#increaseScale" ),
|
increase: $( "#increaseScale" ),
|
||||||
decrease: $( "#decreaseScale" ),
|
decrease: $( "#decreaseScale" ),
|
||||||
display: $( "#scaleDisplay" )
|
display: $( "#scaleDisplay" )
|
||||||
},
|
},
|
||||||
|
|
||||||
|
keyLock: $( "#keyLockLabel" ),
|
||||||
|
|
||||||
patrolSpeed: $( "#patrolSpeed" ),
|
patrolSpeed: $( "#patrolSpeed" ),
|
||||||
|
|
||||||
@@ -128,6 +130,7 @@ const dirs =
|
|||||||
elements.radar.hide();
|
elements.radar.hide();
|
||||||
elements.remote.hide();
|
elements.remote.hide();
|
||||||
elements.uiSettingsBox.hide();
|
elements.uiSettingsBox.hide();
|
||||||
|
elements.keyLock.hide();
|
||||||
|
|
||||||
elements.uiSettingsBtn.click( function() {
|
elements.uiSettingsBtn.click( function() {
|
||||||
setUISettingsVisible( true, true );
|
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 )
|
function playAudio( name, vol )
|
||||||
{
|
{
|
||||||
let audio = new Audio( "sounds/" + audioNames[name] );
|
let audio = new Audio( "sounds/" + audioNames[name] );
|
||||||
@@ -480,6 +492,9 @@ window.addEventListener( "message", function( event ) {
|
|||||||
break;
|
break;
|
||||||
case "lockAudio":
|
case "lockAudio":
|
||||||
playLockAudio( item.ant, item.dir, item.vol );
|
playLockAudio( item.ant, item.dir, item.vol );
|
||||||
|
break;
|
||||||
|
case "displayKeyLock":
|
||||||
|
displayKeyLock();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user