mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-11-23 19:38:36 +00:00
feat(client): Input dialog function
This commit is contained in:
1 parent
3d3a7075d2
commit
ff71a7d033
1 file changed
+22
@@ -0,0 +1,22 @@
|
|||||||
|
function lib.inputDialog(heading, rows)
|
||||||
|
if input then return end
|
||||||
|
input = promise.new()
|
||||||
|
|
||||||
|
SetNuiFocus(true, true)
|
||||||
|
SendNUIMessage({
|
||||||
|
action = 'openDialog',
|
||||||
|
data = {
|
||||||
|
heading = heading,
|
||||||
|
inputs = rows
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return Citizen.Await(input)
|
||||||
|
end
|
||||||
|
|
||||||
|
RegisterNUICallback('inputData', function(data, cb)
|
||||||
|
cb(1)
|
||||||
|
if not input then return end
|
||||||
|
if not data then input:resolve() else input:resolve(data) end
|
||||||
|
SetNuiFocus(false, false)
|
||||||
|
input = nil
|
||||||
|
end)
|
||||||
Reference in new issue
Block a user