promise for dialogue
This commit is contained in:
1 parent
05f7ada1d6
commit
e13c623d4b
1 file changed
+5
-1
@@ -81,12 +81,16 @@ function Dialogue.Open( name, dialogue, characterOptions, dialogueOptions, onSel
|
||||
})
|
||||
SetNuiFocus(true, true)
|
||||
|
||||
|
||||
local prom = promise.new()
|
||||
local wrappedFunction = function(selected)
|
||||
SetNuiFocus(false, false)
|
||||
Dialogue.Close(name)
|
||||
onSelected(selected)
|
||||
if onSelected then onSelected(selected) end
|
||||
prom:resolve(selected)
|
||||
end
|
||||
promises[name] = wrappedFunction
|
||||
return Citizen.Await(prom)
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user