[ad_1]
First of all a BIG thanks to @IceHax for making this possible, here is a link to his Github go check him out
- (11-11-2018) New Natives added, check out the bottom of this tutorial!
.
First thing you have to do is make a discord https://discordapp.com/ account if you haven’t done that already.
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 512×512 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 __resource.lua and one called client.lua
- paste the code below into the correct file
Thanx to @d0p3t, we have 3 new natives now
New Natives:
- SetDiscordRichPresenceAssetSmall
- SetDiscordRichPresenceAssetSmallText
- SetDiscordRichPresenceAssetText
Check the code below to see how to use them and what they do!
__resource.lua:
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
client_script 'client.lua'
client.lua:
Citizen.CreateThread(function()
while true do
--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')
--(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')
--It updates every one 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:
you might want to leave a like if you found this post helpfull
Enjoy!
(This post might contain grammar mistakes)
[ad_2]