[Release] [ESX] Discord rich presence

Hello, im posting my first script.
This script adds discord rich presence.
Rich presence includes:
Job specific icons (easy to configure)
Player ID, name and total players on server.

Feel free to edit the code, but dont forget to mention me :slight_smile:

Preview

image

image

How to configure job icons

  1. Go to Discord Developer Portal
  2. Click on your bot
  3. Make sure to copy your client id, and change it in config.lua
    image
  4. Go to rich presence, art assets and then add images. Note the name of the icon needs be the same as the job in the database

Dependencies

ESX, esx_idenityti, mysql-async,Discord Bot

Change Log

  • 1.0.0 Initial Release
  • 1.0.1 Added Config File
  • 1.0.2 Fixed not getting player count
  • 1.0.3 Added esx_identity support for players firstname and lastname
  • 1.0.4 Added additional checks
  • 1.0.5 Added custom buttons in config thanks to [Free] Discord Action Buttons. (Simple script!)
  • 1.0.6 Fixed some bugs, rewrote the code

Download GitHub - boostless/boost-discordpresence: Discord rich presence with included job's

21 Likes

This is amazing thankyou

1 Like

Yes indeed good job :wink:

1 Like

This script already exist?

I dont really know so I just shared it for everyone :smiley:

Well, there have been tutorials and git releases, but none using esx to my knowledge.

To be fair, this is a pretty original and cool idea :slight_smile:

1 Like

Will add config file for easy configuration :slight_smile:

Don’t Count players in the discord rich presence. Player 0/64 all time.

players = {}

    local playerCount = Config.PlayerCount - 1

    for i = 0,  playerCount do

        if NetworkIsPlayerActive( i ) then

            table.insert( players, i )

        end

    end     

    SetRichPresence('ID:' .. GetPlayerServerId(NetworkGetEntityOwner(GetPlayerPed(-1))) .. ' | ' .. GetPlayerName(PlayerId()) .. ' | ' ..' '.. Config.PlayerText ..' ' .. #players .. '/' .. tostring(Config.PlayerCount))

how to make the nickname displayed by the game instead of the steam name?

Will add this feuture

Doing a fix

Fixed download new version Here (1.4 KB)

3 Likes

Nice work, good for those they are not into all that rich presence stuff! am i allowed to modify the code to learn how sh*t works? :smiley:

1 Like

Thanks Boost. Nice work

1 Like

Ofcourse thats why i shared this :smiley:

1 Like

Okay nice thank u, but i think its better to ask first xD

Well executed. Will be definitely slapped onto mine.

1 Like

I get this when joining on the server.

Reset the script couple of times in console and make sure you are starting script under es_extented

Starting under the ESX framework, only problem is that the script doesnt wait until the player spawns, it tries to retrieve all the info when a player join.