mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
RFR: Renamed file, adjusted manifest, and refactored code.
Renamed the event so its more clear what it does and added a bool to denote when it's being disabled or not. This was attached to `isPhoneOpen` which wasn't reliablly working. Its now done within `showPhone` and `hidePhone`. The wait was changed from `1000` to `100` in the event the phone is opened before the wait is over. Makes it more smooth as there is no longer a small duration where the mouse moves the camera. Removed the enable of control actions as it wasn't needed.
This commit is contained in:
1 parent
1c69cd5e2e
commit
95ed68dff6
4 files changed
+27
-35
No files matched your search
-32
@@ -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)
|
|
||||||
+1
-1
@@ -5,7 +5,7 @@ authors { "itschip", "erik-sn", "TasoOneAsia", "kidz", "RockySouthpaw"}
|
|||||||
|
|
||||||
client_scripts {
|
client_scripts {
|
||||||
'resources/dist/client/*.client.js',
|
'resources/dist/client/*.client.js',
|
||||||
'futile.lua'
|
'resources/client/*.lua'
|
||||||
}
|
}
|
||||||
|
|
||||||
server_script {
|
server_script {
|
||||||
|
|||||||
@@ -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)
|
||||||
@@ -59,6 +59,7 @@ const showPhone = async (): Promise<void> => {
|
|||||||
sendMessage('PHONE', PhoneEvents.SET_TIME, time);
|
sendMessage('PHONE', PhoneEvents.SET_TIME, time);
|
||||||
SetNuiFocus(true, true);
|
SetNuiFocus(true, true);
|
||||||
SetNuiFocusKeepInput(true);
|
SetNuiFocusKeepInput(true);
|
||||||
|
emit('npwd:disableControlActions', true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const hidePhone = async (): Promise<void> => {
|
const hidePhone = async (): Promise<void> => {
|
||||||
@@ -67,6 +68,7 @@ const hidePhone = async (): Promise<void> => {
|
|||||||
await phoneCloseAnim();
|
await phoneCloseAnim();
|
||||||
SetNuiFocus(false, false);
|
SetNuiFocus(false, false);
|
||||||
SetNuiFocusKeepInput(false);
|
SetNuiFocusKeepInput(false);
|
||||||
|
emit('npwd:disableControlActions', false);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* * * * * * * * * * * * *
|
/* * * * * * * * * * * * *
|
||||||
@@ -106,10 +108,8 @@ async function Phone(): Promise<void> {
|
|||||||
}
|
}
|
||||||
if (isPhoneOpen) {
|
if (isPhoneOpen) {
|
||||||
await hidePhone();
|
await hidePhone();
|
||||||
emit('npwd:disableEnableInput');
|
|
||||||
} else {
|
} else {
|
||||||
await showPhone();
|
await showPhone();
|
||||||
emit('npwd:disableEnableInput');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user