If you have a discord account go to https://discordapp.com/developers/applications/
- First make a new application by clicking the “Create an application”
- When you create a new application, you will see a similar page as shown below on the foto.
- You will have to copy the Application id (See the arrow) and save it for later.
- Now you need to navigate to te left navigation bar and go to Rich Presence>Art Assets.
- This is where the magic starts, here you can upload you image.(The image has to be 512x512 pixels or lager)
- If you have uploaded the image you will need to remember the image name and don’t forget to hit “Save Changes”
Now we have the discord application id and the image name. Last, we have to put those values into a script.
I have made a very very getto and simple script for you to test it with.
- make a folder inside the server resource folder and call it discord
- make 2 files one called fxmanifest.lua and one called client.lua
- paste the code below into the correct file
(11-11-2018) Thanx to @d0p3t, we have 3 new natives now
New Natives:
- SetDiscordRichPresenceAssetSmall
- SetDiscordRichPresenceAssetSmallText
- SetDiscordRichPresenceAssetText
(26-02-2021) Thanx to blattersturm, we have a new native
New Native:
- SetDiscordRichPresenceAction
Check the code below to see how to use them and what they do!
fxmanifest.lua:
fx_version 'cerulean'
games { 'gta5' }
client_script 'client.lua'
client.lua:
Citizen.CreateThread(function()
while true do
-- This is the Application ID (Replace this with you own)
SetDiscordAppId(260861119525158913)
-- Here you will have to put the image name for the "large" icon.
SetDiscordRichPresenceAsset('logo_name')
-- (11-11-2018) New Natives:
-- 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')
-- (26-02-2021) New Native:
--[[
Here you can add buttons that will display in your Discord Status,
First paramater is the button index (0 or 1), second is the title and
last is the url (this has to start with "fivem://connect/" or "https://")
]]--
SetDiscordRichPresenceAction(0, "First Button!", "fivem://connect/localhost:30120")
SetDiscordRichPresenceAction(1, "Second Button!", "fivem://connect/localhost:30120")
-- It updates every minute just in case.
Citizen.Wait(60000)
end
end)
If you followed all the steps and used common knowledge, you will see this:
And with the new natives:
New Discord buttons:
you might want to leave a like if you found this post helpfull
Enjoy!
(This post might contain grammar mistakes)