Jump to content

Customizing Discord Rich Presence


pedro157

Recommended Posts

hello I wanted to congratulate the mta developer that time this function Rich Presence mta was very cool but I came here to ask how I make it appear to the player who is in the dicord that he is playing on my server with name and logo

Edited by Vinyard
Link to comment
  • Vinyard changed the title to Customizing Discord Rich Presence
On 30/10/2023 at 04:52, pedro157 said:

hello I wanted to congratulate the mta developer that time this function Rich Presence mta was very cool but I came here to ask how I make it appear to the player who is in the dicord that he is playing on my server with name and logo

local app_id = "my_app_id"

addEventHandler("onClientResourceStart", resourceRoot, function()
    local name = getPlayerName(localPlayer)
    setDiscordApplicationID(app_id)
    if isDiscordRichPresenceConnected() then
       setDiscordRichPresenceAsset("your_app_logo_name", "This is my logo!")
       setDiscordRichPresenceSmallAsset("your_second_app_logo_name", "This is my second logo!")
       setDiscordRichPresenceState("In-game")
       setDiscordRichPresenceDetails("currently as "..name)
    end
end)

addEventHandler("onClientResourceStop", resourceRoot, function()
    resetDiscordRichPresenceData()
end)

 

Edited by Hydra
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...