Files
ox_lib/resource/interface/client/alert.lua

24 lines
445 B
Lua
Raw Normal View History

local alert = nil
2022-06-11 11:33:15 +02:00
function lib.alertDialog(data)
if alert then return end
alert = promise.new()
2022-06-11 11:33:15 +02:00
SetNuiFocus(true, true)
SendNUIMessage({
action = 'sendAlert',
data = data
})
return Citizen.Await(alert)
2022-06-11 11:33:15 +02:00
end
RegisterNUICallback('closeAlert', function(data, cb)
2022-06-11 11:33:15 +02:00
cb(1)
SetNuiFocus(false, false)
alert:resolve(data)
alert = nil
end)
RegisterNetEvent('ox_lib:alertDialog', lib.alertDialog)