API and integration
Exports for other scripts to control banners, and the events the studio uses.
Other scripts can read and control banners through exports. The id is the banner number (the id column of the rvt_banner table).
Exports
Server
| Export | Parameters | Returns |
|---|---|---|
GetBanners() | — | List with the summary of every banner (id, name, owner, enabled, items, mode, plate, distance...). |
GetBanner(id) | id | Banner summary, or nil if it does not exist. |
GetPlayerBanners(owner) | owner | The owner’s banners: list of { id, name, thumb, image, enabled }. owner is the identity as text (decimal passport on Creative/vRP; qb:<citizenid>, qbox:<citizenid>, esx:<identifier> or license:... otherwise). image is the first image item. |
SetBannerContent(id, urls, opts) | id, urls, opts? | true if the content was accepted. urls is the list of links; opts accepts seconds, anim, transition, fit, bg, frame, carousel, sound and volume. |
SetBannerEnabled(id, on) | id, on | true if the banner exists. Turns it on or off without deleting. |
DeleteBanner(id) | id | true if the banner existed. Deletes it permanently. |
Client
| Export | Parameters | Returns |
|---|---|---|
OpenStudio() | — | Opens the studio, like the command. It does not open inside vehicles and requires permission. |
IsStudioOpen() | — | true if the studio is open. |
Examples
-- Server side, any resource
local ok = exports.rvt_banner:SetBannerContent(12, {
'https://i.imgur.com/example.png',
'https://youtu.be/dQw4w9WgXcQ',
}, { seconds = 10, anim = 'kenburns', transition = 'fade' })
if not ok then print('content rejected (bad link, empty list or too many items)') end
exports.rvt_banner:SetBannerEnabled(12, false) -- hide without deleting-- Client side
if not exports.rvt_banner:IsStudioOpen() then
exports.rvt_banner:OpenStudio()
endServer exports update the database and notify all players right away. SetBannerContent rejects invalid links, an empty list and more items than Config.Content.maxItems. They are APIs for trusted server resources: do not expose them directly through client events.
Events
The script uses these events internally. You can listen to the client ones, but you do not need to trigger them.
| Event | Side | When |
|---|---|---|
rvt_banner:index | client | On resource start: light list of all banners. |
rvt_banner:upsert | client | Banner created, edited or enabled/disabled. |
rvt_banner:remove | client | Banner deleted (receives the id). |
rvt_banner:content | client | Content of a banner, sent on demand. |
rvt_banner:saved | client | Reply to a studio save. |
rvt_banner:notify | client | On-screen notice for the player (text and color). |
rvt_banner:save | server | The studio saves a banner (validated again on the server). |
rvt_banner:needContent | server | The client asks for the content of a banner it is about to draw. |
Internal studio functions (Tunnel)
The studio calls these server functions through vSERVER (lib/tunnel.lua), which uses its own events (rvt_banner:rpc:request and rvt_banner:rpc:response), with no vRP Tunnel/Proxy. Only these methods are accepted, with a per-connection call limit and a 15-second client timeout. All of them except index check the player’s permission. For automation use the exports.
| Function | What it does |
|---|---|
open() | Checks access and returns the player’s banners (all, for managers) and the limits. |
index() | Light list of all banners for the client to draw. |
edit(id) | Returns the banner and sends its full content for editing. |
toggle(id, on) | Enables or disables a banner. |
rename(id, name) | Renames a banner (up to 40 characters). |
duplicate(id) | Creates a disabled copy. |
remove(id) | Deletes a banner. |
