Ich zeige euch wie man im Discord eine schöne Information anzeigen lassen kann wenn man sich auf dem FiveM Server befindet.
GitHub Resource: https://github.com/Musiker15/discord_rich_presence
- Neuen Ordner erstellen -> vehiclenames
- Datei im Ordner erstellen -> fxmanifest.lua
In der fxmanifest.lua tragen wir nun folgendes ein:
Code
fx_version 'adamant'
games { 'gta5' }
author 'Musiker15'
description 'Discord Rich Presence'
client_scripts {
'main.lua'
}
Als nächstes erstellen wir eine weitere Datei -> main.lua
und tragen hier folgendes ein:
Code
local WaitTime = 30000 -- How often do you want to update the status (In MS)
local appid = 'Place AppId Here' -- Make an application @ https://discordapp.com/developers/applications/ ID can be found there.
local asset = 'logo_name' -- Go to https://discordapp.com/developers/applications/APPID/rich-presence/assets
Citizen.CreateThread(function()
while true do
Citizen.Wait(WaitTime)
local id = GetPlayerServerId(PlayerId())
local name = GetPlayerName(PlayerId())
local playerCount = #GetActivePlayers()
SetDiscordAppId(appid)
SetDiscordRichPresenceAsset(asset)
SetDiscordRichPresenceAssetText('FlavourV Roleplay')
SetDiscordRichPresenceAssetSmall(asset)
SetDiscordRichPresenceAssetSmallText('FlavourV Roleplay')
SetDiscordRichPresenceAction(0, "Discord", "https://discord.gg/D9bWaybEMC")
SetDiscordRichPresenceAction(1, "Verbinden", "fivem://connect/fivem.flavourv.de:30120")
SetRichPresence(playerCount.."/64 - ID: "..id.." | Name: "..name)
end
end)
Alles anzeigen
Bei local appid = 'Place AppId Here' muss natürlich die AppID des Bots eingegeben werden der auf dem Discord bereits Online ist.
Am Ende sollte das ganze dann folgendermaßen aussehen: