Skip to main content

BenzyDrawText — Events

Events you can trigger (a convenient alternative to the exports) and events you can listen to, each with a ready-to-paste example. The exports are usually cleaner, but events are handy for resources that already speak in TriggerEvent.

The payload fields (id, key, text, lines, position, color, duration, …) mean the same as in EXPORTS.md — see that file for the call shapes and the positions.


Events you can trigger

BenzyDrawText:Show (client, net event)

The channel the server pushes a prompt on — trigger it from the server to draw a prompt on a player. The payload is a table (the same fields the options-table export form accepts).

-- Server -> a single player
TriggerClientEvent('BenzyDrawText:Show', source, {
id = 'atm', key = 'E', text = 'Use the ATM', position = 'bottom-center'
})
-- Server -> everyone
TriggerClientEvent('BenzyDrawText:Show', -1, {
text = 'Server restart in 5 minutes', position = 'top-center', duration = 10000
})

BenzyDrawText:ShowLocal (client, local)

Draw a prompt on this client from another client-side script. Takes the positional args (or a table) just like the export.

-- Client (local prompt)
TriggerEvent('BenzyDrawText:ShowLocal', 'E', 'Open the door')

BenzyDrawText:Hide (client)

Take one prompt down. The payload is the prompt id (a string, or a { id = ... } table); omit it for the default prompt. Trigger from the server (targeted or -1) or locally.

TriggerClientEvent('BenzyDrawText:Hide', source, { id = 'atm' })
TriggerClientEvent('BenzyDrawText:Hide', -1, { id = 'atm' }) -- everyone

BenzyDrawText:Clear (client)

Take every prompt on a player's screen down.

TriggerClientEvent('BenzyDrawText:Clear', source)
TriggerClientEvent('BenzyDrawText:Clear', -1) -- everyone

BenzyDrawText:Send (server → server)

A convenience wrapper around the Show export, for resources that prefer events. Not a net event, so a client cannot reach it.

TriggerEvent('BenzyDrawText:Send', source, 'E', 'Open the door')

BenzyDrawText:SendAll (server → server)

A convenience wrapper around the ShowAll export.

TriggerEvent('BenzyDrawText:SendAll', { text = 'The bank heist has started downtown!', position = 'top-center' })

Events BenzyDrawText fires (listen with AddEventHandler)

BenzyDrawText:Ready (server)

Fired once when the resource has started. Handy if another resource wants to wait for it before wiring itself up.

AddEventHandler('BenzyDrawText:Ready', function()
print('BenzyDrawText is ready')
end)

The server Show export returns true when the arguments are valid (a positive numeric source + a non-empty payload) and the event was dispatched — not a confirmation that the prompt reached or rendered for the player. Events do not return a value.