Project Init, no html

This commit is contained in:
2025-11-12 22:00:22 +01:00
parent 2e6f8bde3d
commit 9889acfe7b
8 changed files with 92 additions and 0 deletions

40
client.lua Normal file
View File

@@ -0,0 +1,40 @@
local phoneOpen = false
RegisterCommand('togglephone', function()
phoneOpen = not phoneOpen
SetNuiFocus(phoneOpen, phoneOpen)
SendNUIMessage({ action = 'toggle', open = phoneOpen })
end, false)
RegisterKeyMapping('togglephone', 'Toggle Phone', 'keyboard', 'M')
RegisterNUICallback('close', function(data, cb)
phoneOpen = false
SetNuiFocus(false, false)
SendNUIMessage({ action = 'toggle', open = false })
cb('ok')
end)
RegisterNUICallback('sendMessage', function(data, cb)
if type(data.message) == 'string' then
TriggerServerEvent('gbcore-phone:sendMessage', data.message)
cb({ stauts = 'sent' })
else
cb({ status = 'error' })
end
end)
RegisterNetEvent('gbcore-phone:receiveMessage')
AddEventHandler('gbcore-phone:receiveMessage', function(sourceId, msg)
SendNUIMessage({ action = 'receiveMessage', from = sourceeId, message = msg })
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if phoneOpen then
DisableControlAction(0, 1, true)
DisableControlAction(0, 2, true)
end
end
end)