Alert dialog
A blocking confirm / cancel modal — await the user's choice in a single line.
A blocking confirm / cancel modal — await the user's choice in a single line.
lib.alertDialog opens a modal with a header, a message and two buttons (Cancel / Confirm).
It blocks until the user answers, then returns their choice.
local choice = lib.alertDialog({
header = 'Delete vehicle',
content = 'Are you sure? This cannot be undone.',
})
if choice == 'confirm' then
deleteVehicle()
endlib.alertDialog(data, timeout?)
data.headerstringrequiredBold title of the modal.
data.contentstringrequiredBody message. Rendered as plain text (HTML is escaped).
timeoutnumberoptionalAuto-close delay in ms. Omitted = waits forever. With a timeout, wrap the call in pcall — a timeout rejects the promise.
Returns 'confirm' if the user confirms, 'cancel' otherwise.
local ok, choice = pcall(lib.alertDialog, {
header = 'Purchase',
content = 'Confirm the purchase?',
}, 5000)
if not ok then return end -- timed out
if choice == 'confirm' then buy() endlib.closeAlertDialog(reason?) closes the active alert from code. From the server,
TriggerClientEvent('see_lib:alertDialog', source, data) opens one (the answer isn't sent
back — use a callback if you need it server-side).
One alert at a time — a second call while one is open returns nil. The two buttons are fixed (Cancel / Confirm): no custom labels, no third button. Always pcall when you pass a timeout.