All resources

rsg-noticeboard – Developer Docs#

Dependencies#

  • rsg-core (locales, notify, callbacks, model loading)
  • rsg-target (board interaction)
  • oxmysql

ox_lib is not used (migrated in v3.1.0).

Structure#

FilePurpose
shared/config.luaMain config (boards, durations, categories, towns)
client/client.luaBoard spawning, blips, target, NUI bridge, expiry renew prompt
client/placer.luaAdmin ghost placer for new boards
server/server.luaNotices, fees, expiry, admin actions, callbacks
server/sv_config.lua / webhooks.luaServer-only config and Discord logs
html/NUI (board, admin panel, modals)
locales/*.jsonen, de, el, es, fr, ja, nl, pl, pt-br, ro, ru

Callbacks (server, RSGCore.Functions.CreateCallback)#

Registered through a local registerCallback(name, fn) wrapper that calls cb(fn(source, ...)), so handlers simply return their value. Client side uses RSGCore.Functions.AwaitCallback(name, 10000, ...).

getBoards, getBoardData, createNotice, renewNotice, deleteOwnNotice, getAdminData, saveBoard, renameBoard, deleteBoard, adminDeleteNotice, adminExtendNotice (all prefixed rsg-noticeboard:server:). Admin callbacks check Config.AdminPermission server-side.

Events#

  • rsg-noticeboard:client:syncBoards – placed board list
  • rsg-noticeboard:client:openAdmin – open admin panel
  • rsg-noticeboard:client:expiryWarning – notice about to expire; shows a notify and opens the NUI expiryRenew prompt (confirm → duration picker → renewNotice)
  • Server notifications use RSGCore:Client:Notify

NUI actions#

openBoard, openAdmin, expiryRenew. NUI callbacks: close, refresh, refreshAdmin, createNotice, renewNotice, deleteOwnNotice, adminDeleteNotice, adminExtendNotice, adminDeleteBoard, adminRenameBoard, adminTeleport, adminPlaceBoard.

Language#

setr rsg:locale "de" (falls back to ox:locale, then en). ui_* keys are sent to the NUI.

Changelog#

  • 3.1.0 – Removed ox_lib: rsg-core locales/notify/callbacks/RequestModel, cache.ped → PlayerPedId(), ox_target → rsg-target, renew alert/context menu moved into the NUI.
<!-- BEGIN AUTO-REFERENCE (generated from the code; re-run the generator instead of editing by hand) -->

Technical reference#

Generated from the source of rsg-noticeboard 3.1.0. Names, arguments and defaults below are read straight from the code.

Dependencies#

rsg-core, rsg-target, oxmysql

Database#

Tables: rsg_noticeboard_boards, rsg_noticeboard_notices.

Tables are created automatically on start while Config.AutoDatabase = true (default). Nothing is ever dropped or overwritten. For a manual install set Config.AutoDatabase = false and import install.sql once.

-- shared/config.lua
Config.AutoDatabase = true -- false = import the SQL file yourself

Configuration#

OptionDefaultNotes
Config.AutoDatabasetruebuild the database tables automatically on start (set false and import the SQL file for a manual install)
Config.BoardModelstable
Config.PlacedBoardModel'mp005_p_mp_bountyboard02x'model admins place with the gizmo
Config.TargetDistance2.5
Config.SpawnDistance120.0placed boards spawn when player is within this range
Config.ShowBlipstrue
Config.BlipSpriteblip_job_board
Config.BlipScale0.2
Config.SeparateTownstrue
Config.Townstable
Config.MoneyType'cash'cash / bank / bloodmoney
Config.MaxNoticesPerPlayer5
Config.PostCooldown30seconds between posts per character
Config.SessionTimeout600seconds a player can stay in the board UI and still post
Config.SessionDistance10.0max distance from where the board was opened when posting
Config.TitleMaxLength60
Config.BodyMaxLength1500
Config.RequireImagefalse
Config.AllowedImageHosts{}image links must start with one of these (leave empty table to allow any https link)
Config.Durationstabledurations: seconds OR months = 1 (calendar month)
Config.Categoriestable
Config.WarnBeforeExpiry60 * 60 * 6warn the poster 6 hours before expiry
Config.CheckInterval60seconds between expiry checks
Config.PlacerKeystable
Config.PlacerRotateSpeed1.5degrees per frame
Config.PlacerHeightSpeed0.01metres per frame
Config.PlacerMaxDistance15.0how far from the camera the board can be placed
Config.AdminPermission'admin'
Config.AdminCommand'noticeadmin'

Callbacks#

CallbackSideArgumentsFile
rsg-noticeboard:server:getBoardsserver``server/server.lua
rsg-noticeboard:server:getBoardDataserversourceserver/server.lua
rsg-noticeboard:server:createNoticeserversource, dataserver/server.lua
rsg-noticeboard:server:renewNoticeserversource, noticeId, durationIdserver/server.lua
rsg-noticeboard:server:deleteOwnNoticeserversource, noticeIdserver/server.lua
rsg-noticeboard:server:getAdminDataserversourceserver/server.lua
rsg-noticeboard:server:saveBoardserversource, dataserver/server.lua
rsg-noticeboard:server:renameBoardserversource, id, labelserver/server.lua
rsg-noticeboard:server:deleteBoardserversource, idserver/server.lua
rsg-noticeboard:server:adminDeleteNoticeserversource, idserver/server.lua
rsg-noticeboard:server:adminExtendNoticeserversource, id, durationIdserver/server.lua
-- client side
RSGCore.Functions.TriggerCallback('rsg-noticeboard:server:getBoards', function(result)
    -- use result
end)

Events#

Server events can be fired by any client, so every handler re-validates the player, the arguments and any permission, distance or cooldown on the server. Never add a reward to a handler without those checks.

EventSideArgumentsFile
rsg-noticeboard:client:syncBoardsclient``client/client.lua
rsg-noticeboard:client:openAdminclient``client/client.lua
rsg-noticeboard:client:expiryWarningclientnclient/client.lua
-- from a server script
TriggerClientEvent('rsg-noticeboard:client:syncBoards', source)

Locales#

Language files in locales/: de, el, en, es, fr, ja, nl, pl, pt-br, ro, ru. Set the language with setr rsg:locale "en".

<!-- END AUTO-REFERENCE -->