Zentra Systems
Docs/LivePresence

LivePresence — setup

Install LivePresence and get it configured on your server. Built for Standalone / ESX / QBox / QBCore. New to Zentra? Start with the Installation guide to set up your core and license first.

Add it to your server

Download LivePresence from your portal, drop the zentra_livepresence folder into your resources directory, and add it to your server.cfg alongside your core and license key:

ensure zt_xxxxxxxxxx                 # your core (install once)
set zentra_license "ZS-XXXX-XXXX-XXXX-XXXX"

ensure zentra_livepresence

One license key runs every product you own, and your core only needs installing once. Full details are in the Installation and License keys guides.

Documentation

From the LivePresence v1.6 README, the same one included in your download.

Discord Rich Presence for FiveM servers. Each player's Discord profile shows what they're doing on your server, live: driving down a street, flying over an area, on patrol as a Sergeant, down and waiting for EMS, AFK. It also shows your logo, rotating server info and two buttons.

  • Live states: on foot, driving, passenger, bike, boat, aircraft, emergency vehicle (siren on or off), swimming, diving, pause menu, AFK, dead. Each state has its own text, icon and hover text, and you set the order they win in.
  • Jobs: police, EMS, mechanic or any job gets its own presence, optionally only while on duty, with a separate line for while they drive.
  • 25+ placeholders: {street}, {zone}, {vehicle}, {speed}, {job}, {grade}, {players}, {uptime}, {weather}, {time} and more, each with fallbacks: {street|the city}.
  • Rotating lines: any text can be a list, and the lines take turns.
  • Privacy mode: players type /presence to hide their location and vehicle. It's remembered between sessions.
  • Frameworks: detects Qbox, QBCore, ESX and ND_Core on its own, runs standalone, or reads your own framework through one function.
  • Exports: other scripts can push their own presence ("Robbing the Pacific Bank") to one player or to everyone ("Server restart in 5 minutes"), or add their own placeholders.
  • Light on the server: it only sends Discord what changed, respects Discord's rate limit, has no dependencies and needs no database.

Installation

  1. Put the zentra_livepresence folder in your resources folder.
  2. Add ensure zentra_livepresence to your server.cfg.
  3. Do the Discord setup below. It takes about 5 minutes.

Step 1: Create your Discord application

  1. Go to https://discord.com/developers/applications and click New Application.
  2. The name you give it is what Discord shows as "Playing ___", so call it after your server, e.g. Liberty City RP.
  3. On the General Information page, copy the Application ID.
  4. Paste it in config.lua: ``lua Config.AppId = '123456789012345678' `` Keep the quotes.

Step 2: Upload your pictures

In the same application, open Rich Presence → Art Assets and upload your images. The name you give each image is its key, and that's what you type in config.lua. The default config uses these keys:

KeyUsed for
logoBig picture (your server logo) and privacy mode
walkOn foot
carDriving, passenger, taxi job
bikeMotorbikes and bicycles
boatBoats
heliHelicopters and planes
swimSwimming and diving
policeEmergency vehicles, police job
emsAmbulance job
wrenchMechanic job
deadDead or downed
afkAFK
mapPause menu
  • Use square PNGs, at least 512×512 (1024×1024 is best). Keys are lowercase.
  • New uploads take 5–15 minutes to show up on Discord. If a picture is missing right after you upload it, wait.
  • You don't need all of them. A state whose icon key doesn't exist simply shows no small picture.

Step 3: Buttons

Config.Buttons = {
    { label = 'Join the Discord', url = 'https://discord.gg/yourserver' },
    { label = 'Connect',          url = 'https://cfx.re/join/xxxxxx' },
}
  • Up to 2 buttons, with labels up to 32 characters.
  • Links must start with https://. Your cfx.re/join link is on your server's page on the FiveM server list.
  • You can't see your own buttons. That's how Discord works. Ask a friend to look at your profile, or check from a second account.

Restart the resource, join your server, and look at your Discord profile.


Writing your texts

Every text in config.lua can use placeholders. Type /presencedebug in game to print every value live into F8.

text = 'Driving a {vehicle} on {street}'

Fallbacks. If a placeholder is empty (no street name out in the hills, no job), the part after | is used:

text = 'Driving on {street|a back road}'

Rotating lines. Give a list instead of one text, and the lines take turns every Config.RotateSeconds:

text = { 'Patrolling {street}', 'Unit {grade} on patrol', '{speed} {unit} heading {heading}' }

Discord cuts every line at 128 characters. Advanced Presence shortens long lines cleanly with "...".

Placeholders

PlaceholderExample
{server}Liberty City RP (your sv_projectName, or Config.ServerName)
{players} / {maxPlayers}37 / 64
{uptime}3h 12m since the server started
{id}14, the player's server ID
{name}Character name from the framework (Steam/FiveM name when there's none)
{username}FiveM name
{job} / {jobLabel} / {grade}police / Police / Sergeant
{street} / {crossing}Main Street / 4th Avenue
{zone}Downtown. Rename areas in Config.ZoneNames
{zonecode}DOWNT, the raw GTA code to use in Config.ZoneNames
{postal}412, if you run nearest-postal
{vehicle}Sultan. Name add-on cars in Config.VehicleNames
{plate}12ABC345
{speed} / {unit}64 / mph (Config.SpeedUnit)
{altitude}1200, in feet above the ground
{heading}NE
{health} / {armor}85 / 50, in percent
{time}2:05 PM in-game (Config.Clock24h for 14:05)
{weather}Rain
{playtime}1h 23m this session
{afk}7m, how long they've been AFK

States

Config.StateOrder is the priority list: the first state that matches wins. For example, a dead player in a car shows dead, not driving, because dead comes first. To change priorities, move entries around. To turn a state off, add enabled = false to it.

driving = {
    text = { 'Driving on {street}', 'Cruising through {zone}' },   -- the main line
    icon = 'car',                                                   -- the small picture
    iconText = '{vehicle} - {speed} {unit}',                        -- its hover text
},
  • dead: GTA death, the framework's death flag (QBCore/Qbox isdead/inlaststand, ESX death events), or any of the state bags listed in stateBags. Most death scripts set one of isDead, dead or down.
  • afk: neither the player nor the camera moved for minutes.
  • emergency: the driver of an emergency-class vehicle who doesn't have a job listed in Config.Jobs. Uses textNoSiren while the siren is off.
  • privacy: the player turned privacy on with /presence.

Jobs

Config.Jobs = {
    police = {
        requireDuty = true,                        -- only while on duty
        text = 'On patrol in {zone}',
        driving = 'Patrolling {street}',           -- optional: while they drive
        icon = 'police', iconText = '{jobLabel} - {grade}',
    },
}

The key is the job's name in your framework (police, ambulance, lspd...). Duty comes from QBCore/Qbox onduty. On ESX, ND_Core and standalone servers, your duty script can set the player's onDuty state bag:

-- server side, in your duty script
Player(source).state:set('onDuty', true, true)

Custom frameworks

Config.Framework = 'custom'
Config.CustomFramework = function()
    local data = exports.my_framework:GetPlayerData()
    return { name = data.fullname, job = data.job, jobLabel = data.jobLabel, grade = data.rank, onDuty = data.duty, dead = data.dead }
end

Exports

Client

-- Show something else until it's cleared (or for 60 seconds). The highest priority wins, and an override always
-- beats the normal states.
exports['zentra_livepresence']:SetOverride('fishing', {
    text = 'Fishing at {zone}', icon = 'fish', iconText = 'Caught 4 fish', priority = 1,
}, 60000)
exports['zentra_livepresence']:ClearOverride('fishing')

-- Your own placeholders, usable in any text in config.lua
exports['zentra_livepresence']:SetVariable('gang', 'Ballas')        -- {gang}
exports['zentra_livepresence']:ClearVariable('gang')

exports['zentra_livepresence']:SetPrivacy(true)
exports['zentra_livepresence']:GetPrivacy()                         -- true / false
exports['zentra_livepresence']:GetCurrent()                         -- what's showing right now
exports['zentra_livepresence']:Refresh()                            -- send everything again now

Server

-- One player
exports['zentra_livepresence']:SetPlayerOverride(source, 'robbery', { text = 'Robbing the Pacific Bank', icon = 'mask', priority = 5 }, 300000)
exports['zentra_livepresence']:ClearPlayerOverride(source, 'robbery')

-- Everyone, e.g. a restart warning
exports['zentra_livepresence']:SetGlobalOverride('restart', { text = 'Server restart in 5 minutes', priority = 100 }, 300000)
exports['zentra_livepresence']:ClearGlobalOverride('restart')

Commands

CommandWhat it does
/presencePrivacy on/off: hides location and vehicle and shows the privacy state instead. Remembered between sessions.
/presencedebugPrints the current state, every text and every placeholder value into F8.

You can rename both in Config.Commands, or set one to '' to turn it off.


Troubleshooting

Nothing shows on Discord

  • Use the Discord desktop app. The browser version can't see games.
  • In Discord, turn on activity sharing under User Settings → Activity Privacy.
  • Discord and FiveM must run on the same PC, and as the same Windows user (both as admin or both not).
  • If F8 says Config.AppId is not set, see Step 1.

It says "Playing FiveM" instead of my server name Config.AppId is wrong or missing. Check it's the Application ID, not the public key or a bot token.

Pictures don't show New art assets take up to 15 minutes. Keys must match exactly (lowercase). Restart Discord.

Buttons don't show You can't see your own buttons, so check from another account. Links must start with https://.

It updates a few seconds late That's on purpose. Discord ignores presence updates that come faster than about one every 4 seconds, so Advanced Presence waits (Config.MinPushSeconds) and then sends the latest state.

Can I use an image link instead of an uploaded asset? Discord accepts direct https:// image links for the big picture, and putting one in Config.LargeImage.key often works. Uploaded art assets are the reliable way, though.

What FiveM lets a script send

FiveM's Discord connection lets a server set: the application, one text line, a big and a small picture with hover texts, and two buttons. Newer Discord presence features, like "Watching" or "Listening" activity types, party size and clickable text lines, aren't available to FiveM scripts. No resource can add them without a separate program on every player's PC.

Performance

Its threads check the player's state once a second (Config.UpdateSeconds), and placeholders are only worked out when a text uses them. The framework is read every 5 seconds, and the server only updates the player count. Expect about 0.01–0.02 ms client resmon.