[How-to] [Updated] Discord rich presence Custom Image 🏞

I have player status for every move they make. What’s the way to remove this? I’ve gone through the Visualizer but it resets everytime I make edits to it.

I am not able to do that, i tried but i am not getting to the display the player count for some reason even before that it says User - 0/32

Do I need to start the script in server.cfg?

1 Like

I’ve had some awful luck on this script and can’t seem to get it to work again. I got this working with my servers but when I updated the pipeline id (server “core”) they suddenly stop working. I’ve tried making the script from scratch, tried remaking the discord app. Yet, having no luck. Does anyone know what the issue might be?

and how do I add it to the FiveM RichPresence script?

Yes, just make a simple resource and start that in the server.cfg.

Make two files:
(Make sure to edit variables accordingly)

client.lua

Citizen.CreateThread(function()
    while true do
        -- Replace the functions below with your own ID and asset-names
        -- This is the Application ID (Replace this with you own)
		SetDiscordAppId(123456788967867867)

        -- Here you will have to put the image name for the "large" icon.
		SetDiscordRichPresenceAsset('logo_name')

        -- Here you can add hover text for the "large" icon.
        SetDiscordRichPresenceAssetText('This is a lage icon with text')
       
        -- Here you will have to put the image name for the "small" icon.
        SetDiscordRichPresenceAssetSmall('logo_name')

        -- Here you can add hover text for the "small" icon.
        SetDiscordRichPresenceAssetSmallText('This is a lsmall icon with text')
        
        
        
        -- Showname implementation with new Native
        -- Old script: https://github.com/Parow/showname
        
        -- Amount of online players (Don't touch)
        local playerCount = #GetActivePlayers()
        
        -- Your own playername (Don't touch)
        local playerName = GetPlayerName(PlayerId())

        -- Set here the amount of slots you have (Edit if needed)
        local maxPlayerSlots = "32"

        -- Sets the string with variables as RichPresence (Don't touch)
        SetRichPresence(string.format("%s - %s/%s", playerName, playerCount, maxPlayerSlots))
        
        -- It updates every one minute just in case.
		Citizen.Wait(60000)
	end
end)

__resource.lua

resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' 
client_script 'client.lua'

1 Like

why does a very large amount of player on the server

1 Like

just have me on the server and it shows 200 player

1 Like

What code did you use? (you can send it privately if you want)

2 Likes

2 Likes

I’ve tested it and it works just fine, maby you have a old server version where the “GetActivePlayers()” native is missing, this was added in v1.0.0.1367 on June 28th, so make sure you server version is v1.0.0.1367 or above

1 Like

did I update the game artifacts?

1 Like

I don’t know how to update with your link

1 Like

Hi i have also problem with player counter is meybe problem in rich presence? Meybe i set some thing wrong i am not sure now. I whant to remove player location and set only how many are them online.

1 Like

Sorry for the late response, but yes you need a newer version from the artifacts for the native to work (any version after 1367 sould work) https://runtime.fivem.net/artifacts/fivem/build_server_windows/master/

1 Like

it doesn’t work for me

2 Likes

I’m alone on the server and tag 119 playersCapturar

1 Like

already updated the artifacts

2 Likes

I have chnaged the code for you with the old method of counting the online players, instead of “GetActivePlyers()” i use a simple for loop
Try this code

client.lua

Citizen.CreateThread(function()
    while true do
        -- Replace the functions below with your own ID and asset-names
        -- This is the Application ID (Replace this with you own)
		SetDiscordAppId(123456788967867867)

        -- Here you will have to put the image name for the "large" icon.
		SetDiscordRichPresenceAsset('logo_name')

        -- Here you can add hover text for the "large" icon.
        SetDiscordRichPresenceAssetText('This is a lage icon with text')
       
        -- Here you will have to put the image name for the "small" icon.
        SetDiscordRichPresenceAssetSmall('logo_name')

        -- Here you can add hover text for the "small" icon.
        SetDiscordRichPresenceAssetSmallText('This is a lsmall icon with text')
       
        
        -- Your own playername (Don't touch)
        local playerName = GetPlayerName(PlayerId())

        -- Set here the amount of slots you have (Edit if needed)
        local maxPlayerSlots = 32

        -- For loop to get active player (Legacy method)
        local playerCount= 0
        for i = 0, maxPlayerSlots do
            if NetworkIsPlayerActive(i) then
                 playerCount = playerCount+1
            end
        end

        -- Sets the string with variables as RichPresence (Don't touch)
        SetRichPresence(string.format("%s - %s/%s", playerName, playerCount, maxPlayerSlots))
        
        -- It updates every one minute just in case.
		Citizen.Wait(60000)
	end
end)
5 Likes