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:
RockySouthpaw committed 2020-08-29 14:57:09 -04:00
1 parent d151e31a53
commit c5e750c6b2
1 file changed
+39 -6
+39 -6
View File
@@ -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)