diff --git a/futile.lua b/futile.lua deleted file mode 100644 index 0eb4329..0000000 --- a/futile.lua +++ /dev/null @@ -1,32 +0,0 @@ -isPhoneOpen = false - -CreateThread(function() - while true do - Wait(5) - if isPhoneOpen then - DisableControlAction(0, 1, true) -- Look Left/Right - DisableControlAction(0, 2, true) -- Look up/Down - DisableControlAction(0, 16, true) -- Next Weapon - DisableControlAction(0, 17, true) -- Select Previous Weapon - DisableControlAction(0, 22, true) -- Jump - DisableControlAction(0, 24, true) -- Attack - DisableControlAction(0, 25, true) -- Aim - DisableControlAction(0, 37, true) -- Weapon Wheel - else - EnableControlAction(0, 1, true) -- Look Left/Right - EnableControlAction(0, 2, true) -- Look up/Down - EnableControlAction(0, 17, true) -- Select Previous Weapon - EnableControlAction(0, 22, true) -- Jump - EnableControlAction(0, 24, true) -- Attack - EnableControlAction(0, 25, true) -- Aim - EnableControlAction(0, 37, true) -- Weapon Wheel - EnableControlAction(0, 16, true) -- Next Weapon - Wait(1000) - end - end -end) - -RegisterNetEvent('npwd:disableEnableInput') -AddEventHandler('npwd:disableEnableInput', function() - isPhoneOpen = not isPhoneOpen -end) \ No newline at end of file diff --git a/fxmanifest.lua b/fxmanifest.lua index 6f01192..ecb0d05 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -5,7 +5,7 @@ authors { "itschip", "erik-sn", "TasoOneAsia", "kidz", "RockySouthpaw"} client_scripts { 'resources/dist/client/*.client.js', - 'futile.lua' + 'resources/client/*.lua' } server_script { diff --git a/resources/client/cl_controls.lua b/resources/client/cl_controls.lua new file mode 100644 index 0000000..581691e --- /dev/null +++ b/resources/client/cl_controls.lua @@ -0,0 +1,24 @@ +local disableKeys + +CreateThread(function() + while true do + if disableKeys then + Wait(0) + DisableControlAction(0, 1, true) -- Look Left/Right + DisableControlAction(0, 2, true) -- Look up/Down + DisableControlAction(0, 16, true) -- Next Weapon + DisableControlAction(0, 17, true) -- Select Previous Weapon + DisableControlAction(0, 22, true) -- Jump + DisableControlAction(0, 24, true) -- Attack + DisableControlAction(0, 25, true) -- Aim + DisableControlAction(0, 37, true) -- Weapon Wheel + else + Wait(100) + end + end +end) + +RegisterNetEvent('npwd:disableControlActions') +AddEventHandler('npwd:disableControlActions', function(bool) + disableKeys = bool +end) \ No newline at end of file diff --git a/resources/client/cl_main.ts b/resources/client/cl_main.ts index 3248f43..857fd35 100644 --- a/resources/client/cl_main.ts +++ b/resources/client/cl_main.ts @@ -59,6 +59,7 @@ const showPhone = async (): Promise => { sendMessage('PHONE', PhoneEvents.SET_TIME, time); SetNuiFocus(true, true); SetNuiFocusKeepInput(true); + emit('npwd:disableControlActions', true); }; const hidePhone = async (): Promise => { @@ -67,6 +68,7 @@ const hidePhone = async (): Promise => { await phoneCloseAnim(); SetNuiFocus(false, false); SetNuiFocusKeepInput(false); + emit('npwd:disableControlActions', false); }; /* * * * * * * * * * * * * @@ -106,10 +108,8 @@ async function Phone(): Promise { } if (isPhoneOpen) { await hidePhone(); - emit('npwd:disableEnableInput'); } else { await showPhone(); - emit('npwd:disableEnableInput'); } }