Integrations
Plug in your notifications, set up Discord logs and the webhook, translate texts, host the DUI page, serve local media with httpmanager and tune sound emitters.
Goal: adapt PMMS to your server without touching protected files.
Files: integrations/client.lua, integrations/server.lua, config.server.lua, locales.lua, staticEmitters.lua and server.cfg.
Notifications
Every PMMS notification goes through PMMSBridge.notify(args) in integrations/client.lua. By default it shows them in the PMMS NUI. The fields used are args.text, args.title (resource name by default) and args.duration (Config.notificationDuration by default).
Example with ox_lib:
function PMMSBridge.notify(args)
if type(args) ~= "table" then
args = {}
end
lib.notify({
title = args.title or "Radio",
description = args.text,
duration = args.duration or Config.notificationDuration
})
end
Then add '@ox_lib/init.lua' to the manifest’s shared_scripts, or replace lib.notify with your notification script’s export.
Result: “No media player nearby” and error messages show in your notification system. Config.showNotifications = false hides most of them (see Configuration).
Discord logs
The server sends a “Lien PMMS lancé” embed for every accepted playback (“Demande de lecture”), every queue addition and every start by the server or an export (“Lancement serveur/export”), including default media players at start and player copies.
- In
server.cfg, afterexec @pmms/permissions.cfg:
set pmms_webhook "https://discord.com/api/webhooks/…"
- In
config.server.lua, setlogsEnabled,logName,logColorandincludeIdentifiers(see Configuration).
The embed holds the action, the player’s name and ID, the handle, the title, the URL, the position, the volume, the video flag and, when includeIdentifiers = true, all the player’s identifiers. The embed labels are written in French in integrations/server.lua; edit that file to change the formatting.
Texts
locales.lua maps each original text to its translation. Edit the value on the right, keep the key on the left and the %s, %d markers:
["No media player nearby"] = "No speaker around",
["You must specify a URL to play."] = "Enter a URL to play.",
The shipped values repeat the original texts, mostly in English. The panel texts (buttons, labels) are in ui/index.html and ui/script.js.
DUI page
To show a video on a screen (model with a renderTarget, or scaleform), every client opens a DUI browser on a web page:
https://media:Config.dui.urls.https, shipped ashttps://pmms-dui.mrpoulpiii.fr;http://media:Config.dui.urls.httpwhen set, otherwisehttp://<server address>/pmms/dui/, which the archive does not provide.
If the page does not answer within Config.dui.timeout (30 s), F8 shows “Failed to initialize DUI browser” and the screen stays black. The page’s code is not in the archive.
Hosting your own page: the original resource’s DUI page is published by kibook (kibook/pmms-dui repository). Deploy it on your HTTPS hosting, then:
Config.dui.urls.https = "https://dui.my-server.com"
dui.my-server.com is an example. Check that this page is compatible with your PMMS version before switching.
httpmanager and local media
pmms declares httpmanager as the resource’s HTTP handler: files placed in pmms/http/ are served at http://<server address>/pmms/…. A media whose URL starts with neither http:// nor https:// is looked up in pmms/http/media/. That folder does not exist in the archive: create it to serve your own files.
/pmms_play announcement.ogg
plays pmms/http/media/announcement.ogg. As the file name is not an allowed URL, this needs pmms.anyUrl, a matching pattern in Config.allowedUrls, or a preset whose url is that name. These media go through http://: on a screen, they need an http DUI page (see above).
httpmanager also publishes, at its own address, a password/ page and a hash generation route used by its authentication features.
Sound emitters
staticEmitters.lua lists 301 GTA map sound emitters (bar music, ambience…). With Config.autoDisableStaticEmitters = true, they are muted while a media is audible, then restored according to their enabled value. Set enabled = false on an emitter to keep it muted permanently.
External services contacted
| Service | When | By whom |
|---|---|---|
DUI page (Config.dui.urls.https) |
https:// video on a screen |
Every client |
| Media address | Every playback | Every client in range |
redm.khzae.net (phonograph noise) |
Filter on, on RedM | Every client in range |
| Discord webhook | Logs enabled | The server |
Common mistakes
- Duplicate notifications: your
PMMSBridge.notifycalls your system and the originalSendNUIMessage. libis nil inintegrations/client.lua: ox_lib is not loaded by the pmms manifest.- No log: empty webhook, declared before the
exec, orlogsEnabled = false. - Black screen with an
http://media: nohttpDUI page is available.