mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 23:16:03 +01:00
25 lines
473 B
Lua
25 lines
473 B
Lua
local alert = nil
|
|
|
|
function lib.alertDialog(data)
|
|
if alert then return end
|
|
alert = promise.new()
|
|
|
|
SetNuiFocus(true, true)
|
|
SendNUIMessage({
|
|
action = 'sendAlert',
|
|
data = data
|
|
})
|
|
|
|
return Citizen.Await(alert)
|
|
end
|
|
|
|
RegisterNUICallback('closeAlert', function(data, cb)
|
|
cb(1)
|
|
SetNuiFocus(false, false)
|
|
local promise = alert
|
|
alert = nil
|
|
promise:resolve(data)
|
|
end)
|
|
|
|
RegisterNetEvent('ox_lib:alertDialog', lib.alertDialog)
|