mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 01:38:52 +00:00
refactor: control disabler thread
This commit is contained in:
@@ -17,7 +17,7 @@ RegisterNetEvent('esx_identity:setPlayerData', function(data)
|
||||
ESX.SetPlayerData('sex', data.sex)
|
||||
ESX.SetPlayerData('height', data.height)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
AddEventHandler('esx:loadingScreenOff', function()
|
||||
loadingScreenFinished = true
|
||||
@@ -35,11 +35,12 @@ if not Config.UseDeferrals then
|
||||
|
||||
if state then
|
||||
SetTimecycleModifier(timecycleModifier)
|
||||
CreateThread(disableControls)
|
||||
else
|
||||
ClearTimecycleModifier()
|
||||
end
|
||||
|
||||
SendNUIMessage({type = "enableui",enable = state})
|
||||
SendNUIMessage({type = "enableui", enable = state})
|
||||
end
|
||||
|
||||
RegisterNetEvent('esx_identity:showRegisterIdentity', function()
|
||||
@@ -50,47 +51,42 @@ if not Config.UseDeferrals then
|
||||
|
||||
RegisterNUICallback('register', function(data, cb)
|
||||
ESX.TriggerServerCallback('esx_identity:registerIdentity', function(callback)
|
||||
if callback then
|
||||
ESX.ShowNotification(TranslateCap('thank_you_for_registering'))
|
||||
EnableGui(false)
|
||||
if not callback then
|
||||
return
|
||||
end
|
||||
|
||||
if not ESX.GetConfig().Multichar then
|
||||
TriggerEvent('esx_skin:playerRegistered')
|
||||
end
|
||||
ESX.ShowNotification(TranslateCap('thank_you_for_registering'))
|
||||
EnableGui(false)
|
||||
|
||||
if not ESX.GetConfig().Multichar then
|
||||
TriggerEvent('esx_skin:playerRegistered')
|
||||
end
|
||||
end, data)
|
||||
end)
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
local sleep = 1500
|
||||
function disableControls()
|
||||
while guiEnabled do
|
||||
DisableControlAction(0, 1, true) -- LookLeftRight
|
||||
DisableControlAction(0, 2, true) -- LookUpDown
|
||||
DisableControlAction(0, 106, true) -- VehicleMouseControlOverride
|
||||
DisableControlAction(0, 142, true) -- MeleeAttackAlternate
|
||||
DisableControlAction(0, 30, true) -- MoveLeftRight
|
||||
DisableControlAction(0, 31, true) -- MoveUpDown
|
||||
DisableControlAction(0, 21, true) -- disable sprint
|
||||
DisableControlAction(0, 24, true) -- disable attack
|
||||
DisableControlAction(0, 25, true) -- disable aim
|
||||
DisableControlAction(0, 47, true) -- disable weapon
|
||||
DisableControlAction(0, 58, true) -- disable weapon
|
||||
DisableControlAction(0, 263, true) -- disable melee
|
||||
DisableControlAction(0, 264, true) -- disable melee
|
||||
DisableControlAction(0, 257, true) -- disable melee
|
||||
DisableControlAction(0, 140, true) -- disable melee
|
||||
DisableControlAction(0, 141, true) -- disable melee
|
||||
DisableControlAction(0, 143, true) -- disable melee
|
||||
DisableControlAction(0, 75, true) -- disable exit vehicle
|
||||
DisableControlAction(27, 75, true) -- disable exit vehicle
|
||||
|
||||
if guiEnabled then
|
||||
sleep = 0
|
||||
DisableControlAction(0, 1, true) -- LookLeftRight
|
||||
DisableControlAction(0, 2, true) -- LookUpDown
|
||||
DisableControlAction(0, 106, true) -- VehicleMouseControlOverride
|
||||
DisableControlAction(0, 142, true) -- MeleeAttackAlternate
|
||||
DisableControlAction(0, 30, true) -- MoveLeftRight
|
||||
DisableControlAction(0, 31, true) -- MoveUpDown
|
||||
DisableControlAction(0, 21, true) -- disable sprint
|
||||
DisableControlAction(0, 24, true) -- disable attack
|
||||
DisableControlAction(0, 25, true) -- disable aim
|
||||
DisableControlAction(0, 47, true) -- disable weapon
|
||||
DisableControlAction(0, 58, true) -- disable weapon
|
||||
DisableControlAction(0, 263, true) -- disable melee
|
||||
DisableControlAction(0, 264, true) -- disable melee
|
||||
DisableControlAction(0, 257, true) -- disable melee
|
||||
DisableControlAction(0, 140, true) -- disable melee
|
||||
DisableControlAction(0, 141, true) -- disable melee
|
||||
DisableControlAction(0, 143, true) -- disable melee
|
||||
DisableControlAction(0, 75, true) -- disable exit vehicle
|
||||
DisableControlAction(27, 75, true) -- disable exit vehicle
|
||||
else
|
||||
sleep = 1500
|
||||
end
|
||||
|
||||
Wait(sleep)
|
||||
Wait(0)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user