mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 14:38:45 +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
+29
-21
@@ -6,39 +6,47 @@ Citizen.CreateThread(function()
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
end)
|
||||
------------------------------------------------------------------------ End of ESX
|
||||
|
||||
--RegisterCommand('phone:get', function(source, args, rawCommand)
|
||||
-- TriggerServerEvent('phone:server:getCredentials')
|
||||
--end, false)
|
||||
|
||||
RegisterCommand('phone:open', function(source, args, rawCommand)
|
||||
TriggerServerEvent('phone:getCredentials', source)
|
||||
local isPhoneOpen = false
|
||||
|
||||
RegisterCommand('phone', function(source) -- Toggles Phone
|
||||
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)
|
||||
|
||||
|
||||
RegisterNetEvent('phone:send')
|
||||
AddEventHandler('phone:send', function()
|
||||
SendNUIMessage(
|
||||
{
|
||||
app = 'PHONE',
|
||||
method = 'setVisibility',
|
||||
data = true
|
||||
}
|
||||
)
|
||||
SetNuiFocus(true, true)
|
||||
TriggerEvent('phone:sendContacts')
|
||||
end)
|
||||
|
||||
RegisterCommand('phone:hide', function(source, args, rawCommand)
|
||||
SendNUIMessage(
|
||||
{
|
||||
app = 'PHONE',
|
||||
method = 'setVisibility',
|
||||
data = false
|
||||
}
|
||||
)
|
||||
SetNuiFocus(false, false)
|
||||
end, false)
|
||||
|
||||
RegisterNUICallback('phone:close', function()
|
||||
SendNUIMessage(
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user