diff --git a/client.lua b/client.lua new file mode 100644 index 0000000..e62cff3 --- /dev/null +++ b/client.lua @@ -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) \ No newline at end of file diff --git a/fxmanifest.lua b/fxmanifest.lua new file mode 100644 index 0000000..9e46549 --- /dev/null +++ b/fxmanifest.lua @@ -0,0 +1,18 @@ +fx_version 'cerulean' +game 'gta5' + +author 'GB-Core' +description 'Standalone mobile phone' +version '1.0.0' + +ui_page 'html/index.html' + +files { + 'html/index.html', + 'html/style.css', + 'html/app.js', + 'html/img/apps/*' +} + +client_script 'client.lua' +server_script 'server.lua' \ No newline at end of file diff --git a/html/app.js b/html/app.js new file mode 100644 index 0000000..e69de29 diff --git a/html/img/apps/contacts.png b/html/img/apps/contacts.png new file mode 100644 index 0000000..1367d3f Binary files /dev/null and b/html/img/apps/contacts.png differ diff --git a/html/img/apps/messages.png b/html/img/apps/messages.png new file mode 100644 index 0000000..54a3d89 Binary files /dev/null and b/html/img/apps/messages.png differ diff --git a/html/index.html b/html/index.html new file mode 100644 index 0000000..ddac496 --- /dev/null +++ b/html/index.html @@ -0,0 +1,14 @@ + + +
+ + +