mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-09-04 16:23:22 +00:00
ADD - initial commit
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
local is_open = false
|
||||
|
||||
local function get_locale()
|
||||
return Locales[Sky.Config.locale] or Locales["en"]
|
||||
end
|
||||
|
||||
local function send_open_message()
|
||||
SendNUIMessage({
|
||||
type = "app:open",
|
||||
data = {
|
||||
lang = Sky.Config.locale,
|
||||
locales = get_locale().Nui,
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
local function open_phone()
|
||||
if is_open then
|
||||
return
|
||||
end
|
||||
|
||||
is_open = true
|
||||
SetNuiFocus(true, true)
|
||||
send_open_message()
|
||||
end
|
||||
|
||||
local function close_phone()
|
||||
if not is_open then
|
||||
return
|
||||
end
|
||||
|
||||
is_open = false
|
||||
SetNuiFocus(false, false)
|
||||
SendNUIMessage({ type = "app:close" })
|
||||
end
|
||||
|
||||
RegisterCommand(Config.Command, function()
|
||||
if is_open then
|
||||
close_phone()
|
||||
return
|
||||
end
|
||||
|
||||
open_phone()
|
||||
end, false)
|
||||
|
||||
RegisterNUICallback("ui:ready", function(_, cb)
|
||||
if is_open then
|
||||
send_open_message()
|
||||
end
|
||||
|
||||
cb({ success = true })
|
||||
end)
|
||||
|
||||
RegisterNUICallback("close", function(_, cb)
|
||||
close_phone()
|
||||
cb({ success = true })
|
||||
end)
|
||||
|
||||
CreateThread(function()
|
||||
TriggerEvent("chat:addSuggestion", "/" .. Config.Command, get_locale().CommandDescription)
|
||||
end)
|
||||
|
||||
AddEventHandler("onResourceStop", function(resource_name)
|
||||
if resource_name ~= GetCurrentResourceName() then
|
||||
return
|
||||
end
|
||||
|
||||
if is_open then
|
||||
SetNuiFocus(false, false)
|
||||
end
|
||||
|
||||
TriggerEvent("chat:removeSuggestion", "/" .. Config.Command)
|
||||
end)
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Sky Phone</title>
|
||||
<script type="module" crossorigin src="./assets/sky-index-D5IGMOYX.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/sky-index-DMw9emdW.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user