mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
Add togglephone via keybind.
Should owrk, but needs testing later. --RegisterKeyMapping('phone', _U('keymap_phone'), 'keyboard', '') is commented out for now as its essentially a keybind to do a command.
This commit is contained in:
1 parent
d151e31a53
commit
c5e750c6b2
1 file changed
+39
-6
@@ -6,13 +6,46 @@ Citizen.CreateThread(function()
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
end)
|
||||
------------------------------------------------------------------------ End of ESX
|
||||
|
||||
--RegisterCommand('phone:get', function(source, args, rawCommand)
|
||||
-- TriggerServerEvent('phone:server:getCredentials')
|
||||
--end, false)
|
||||
|
||||
-----
|
||||
--END OF ESX
|
||||
-----
|
||||
local isPhoneOpen = false
|
||||
--RegisterKeyMapping('phone', _U('keymap_phone'), 'keyboard', '')
|
||||
|
||||
--[[RegisterCommand('phone:get', function(source, args, rawCommand)
|
||||
riggerServerEvent('phone:server:getCredentials')
|
||||
end, false)]]
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(10)
|
||||
if IsControlJustPressed(1, Config.KeyTogglePhone) then
|
||||
if isPhoneOpen == false then
|
||||
isPhoneOpen = true
|
||||
print(Config.KeyTogglePhone) --Left for testing purposes.
|
||||
SendNUIMessage( -- Shows phone
|
||||
{
|
||||
app = 'PHONE',
|
||||
method = 'setVisibility',
|
||||
data = true
|
||||
}
|
||||
)
|
||||
SetNuiFocus(true, true)
|
||||
elseif isPhoneOpen == true then
|
||||
isPhoneOpen = false
|
||||
print(Config.KeyTogglePhone) --Left for testing purposes.
|
||||
SendNUIMessage( -- Hides phone
|
||||
{
|
||||
app = 'PHONE',
|
||||
method = 'setVisibility',
|
||||
data = false
|
||||
}
|
||||
)
|
||||
SetNuiFocus(false, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterCommand('phone', function(source) -- Toggles Phone
|
||||
TriggerServerEvent('phone:getCredentials', source)
|
||||
|
||||
Reference in new issue
Block a user