mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
Added a toggle comand, removed hide/open
Command phone:open was used to open the phone and phone:hide was used to hide it. (Obviously kek)
Consolodated it into one command. /phone.
Removed the NUI Message from phone:send, but left the `TriggerEvent('phone:sendContacts')`
This commit is contained in:
1 parent
c78eba04c9
commit
c804945e00
1 file changed
+28
-20
@@ -6,39 +6,47 @@ Citizen.CreateThread(function()
|
|||||||
Citizen.Wait(0)
|
Citizen.Wait(0)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
------------------------------------------------------------------------ End of ESX
|
||||||
|
|
||||||
--RegisterCommand('phone:get', function(source, args, rawCommand)
|
--RegisterCommand('phone:get', function(source, args, rawCommand)
|
||||||
-- TriggerServerEvent('phone:server:getCredentials')
|
-- TriggerServerEvent('phone:server:getCredentials')
|
||||||
--end, false)
|
--end, false)
|
||||||
|
|
||||||
RegisterCommand('phone:open', function(source, args, rawCommand)
|
local isPhoneOpen = false
|
||||||
|
|
||||||
|
RegisterCommand('phone', function(source) -- Toggles Phone
|
||||||
TriggerServerEvent('phone:getCredentials', source)
|
TriggerServerEvent('phone:getCredentials', source)
|
||||||
|
if isPhoneOpen == false then
|
||||||
|
isPhoneOpen = true
|
||||||
|
print("phone is now open") --Left for testing purposes.
|
||||||
|
SendNUIMessage( -- Shows phone
|
||||||
|
{
|
||||||
|
app = 'PHONE',
|
||||||
|
method = 'setVisibility',
|
||||||
|
data = true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
SetNuiFocus(true, true)
|
||||||
|
else
|
||||||
|
isPhoneOpen = false
|
||||||
|
print("phone is now closed") --Left for testing purposes.
|
||||||
|
SendNUIMessage( -- Hides phone
|
||||||
|
{
|
||||||
|
app = 'PHONE',
|
||||||
|
method = 'setVisibility',
|
||||||
|
data = false
|
||||||
|
}
|
||||||
|
)
|
||||||
|
SetNuiFocus(false, false)
|
||||||
|
end
|
||||||
end, false)
|
end, false)
|
||||||
|
|
||||||
|
|
||||||
RegisterNetEvent('phone:send')
|
RegisterNetEvent('phone:send')
|
||||||
AddEventHandler('phone:send', function()
|
AddEventHandler('phone:send', function()
|
||||||
SendNUIMessage(
|
|
||||||
{
|
|
||||||
app = 'PHONE',
|
|
||||||
method = 'setVisibility',
|
|
||||||
data = true
|
|
||||||
}
|
|
||||||
)
|
|
||||||
SetNuiFocus(true, true)
|
|
||||||
TriggerEvent('phone:sendContacts')
|
TriggerEvent('phone:sendContacts')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterCommand('phone:hide', function(source, args, rawCommand)
|
|
||||||
SendNUIMessage(
|
|
||||||
{
|
|
||||||
app = 'PHONE',
|
|
||||||
method = 'setVisibility',
|
|
||||||
data = false
|
|
||||||
}
|
|
||||||
)
|
|
||||||
SetNuiFocus(false, false)
|
|
||||||
end, false)
|
|
||||||
|
|
||||||
RegisterNUICallback('phone:close', function()
|
RegisterNUICallback('phone:close', function()
|
||||||
SendNUIMessage(
|
SendNUIMessage(
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user