promise for dialogue

This commit is contained in:
gononono64 committed 2025-02-28 16:08:18 -06:00
1 parent 05f7ada1d6
commit e13c623d4b
1 file changed
+5 -1
+5 -1
View File
@@ -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