Improvements to Discord Presence

This commit is contained in:
Jacob
2023-04-28 21:26:12 +01:00
parent 9c0b873be4
commit 06b7a6ab9b
9 changed files with 13 additions and 81 deletions
File diff suppressed because one or more lines are too long
@@ -51,7 +51,7 @@ Citizen.CreateThread(function()
elseif Config.RichPresenceText == "discordServer" then
SetRichPresence(Translation[Config.Locale]['discordserver_text'] ..Config.YourDisordServerLink)
elseif Config.RichPresenceText == "customEGRP" then
SetRichPresence(playername.." ID: "..id.." | Players: "..onlinePlayers.." | Currently at: "..zone)
SetRichPresence("ID: "..id.." | Players: "..onlinePlayers.." | Currently at "..zone)
else
SetRichPresence(Config.RichPresenceText)
end
@@ -84,7 +84,7 @@ Citizen.CreateThread(function()
elseif Config.LargeImageText == "discordServer" then
SetDiscordRichPresenceAssetText(Translation[Config.Locale]['discordserver_text'] ..Config.YourDisordServerLink)
elseif Config.RichPresenceText == "customEGRP" then
SetRichPresence(playername.." ID: "..id.." | Players: "..onlinePlayers.." | Currently at: "..zone)
SetRichPresence("ID: "..id.." | Players: "..onlinePlayers.." | Currently at "..zone)
else
SetDiscordRichPresenceAssetText(Config.LargeImageText)
end
@@ -121,7 +121,7 @@ Citizen.CreateThread(function()
elseif Config.SmallImageText == "discordServer" then
SetDiscordRichPresenceAssetSmallText(Translation[Config.Locale]['discordserver_text'] ..Config.YourDisordServerLink)
elseif Config.RichPresenceText == "customEGRP" then
SetRichPresence(playername.." ID: "..id.." | Players: "..onlinePlayers.." | Currently at: "..zone)
SetRichPresence("ID: "..id.." | Players: "..onlinePlayers.." | Currently at "..zone)
else
SetDiscordRichPresenceAssetSmallText(Config.SmallImageText)
end
@@ -2,7 +2,7 @@ Config = {}
Translation = {}
Config.ApplicationID = "543866591079694346" -- Enter your Discord Application ID --> https://discord.com/developers/applications/
Config.UpdateTime = 5 -- 1 = 1 Second -> Updates every Second. Default is 60 Seconds
Config.UpdateTime = 1 -- 1 = 1 Second -> Updates every Second. Default is 60 Seconds
Config.Locale = "en" -- Current translations: de, en
Config.YourDisordServerLink = "https://discord.elitegami.ng"
@@ -36,10 +36,10 @@ Config.LargeImageText = "Elite Gaming RP" -- Text which shows up if you hover im
Config.EnableSmallImage = false -- Small Image enabled. Replace true with false to disable.
Config.SmallImageName = "YOUR_IMAGE_NAME" -- Image Name without .png, .jpg, or .jpeg --> https://discord.com/developers/applications/YOUR_APPLICATION_ID/rich-presence/assets
Config.SmallImageName = "fivem" -- Image Name without .png, .jpg, or .jpeg --> https://discord.com/developers/applications/YOUR_APPLICATION_ID/rich-presence/assets
Config.EnableSmallImageText = false -- Text which shows up if you hover small image. Replace true with false to disable.
Config.SmallImageText = "standard" -- Text which shows up if you hover image.
Config.SmallImageText = "EGRP on FiveM!" -- Text which shows up if you hover image.
@@ -55,8 +55,8 @@ Config.Buttons = {
Index = 0,
Label = "Discord",
URL = "https://discord.com/invite/x6PwsHtVjE"
}
ButtonWebsite = {
},
{
Index = 1,
Label = "Connect",
URL = "fivem://connect/play.elitegami.ng:30120"
@@ -1,58 +0,0 @@
local WaitTime = 5000 -- How often do you want to update the status (In MS)
local DiscordAppId = tonumber(GetConvar("RichAppId", "543866591079694346"))
local DiscordAppAsset = GetConvar("RichAssetId", "eg-blurple")
Citizen.CreateThread(function()
Citizen.Wait(3000)
SetDiscordAppId(DiscordAppId)
SetDiscordRichPresenceAsset(DiscordAppAsset)
for _, v in pairs(Config.Buttons) do
SetDiscordRichPresenceAction(v.index, v.name, v.url)
end
while true do
local x,y,z = table.unpack(GetEntityCoords(PlayerPedId(),true))
local StreetHash = GetStreetNameAtCoord(x, y, z)
local onlinePlayers = #GetActivePlayers()
Citizen.Wait(WaitTime)
if StreetHash ~= nil then
miid = GetPlayerServerId(NetworkGetEntityOwner(GetPlayerPed(-1)))
StreetName = GetStreetNameFromHashKey(StreetHash)
if IsPedOnFoot(PlayerPedId()) and not IsEntityInWater(PlayerPedId()) then
if IsPedSprinting(PlayerPedId()) then
SetRichPresence("ID: "..miid.." | Players: "..onlinePlayers.." | Sprinting down "..StreetName)
elseif IsPedRunning(PlayerPedId()) then
SetRichPresence("ID: "..miid.." | Players: "..onlinePlayers.." | Running down "..StreetName)
elseif IsPedWalking(PlayerPedId()) then
SetRichPresence("ID: "..miid.." | Players: "..onlinePlayers.." | Walking down "..StreetName)
elseif IsPedStill(PlayerPedId()) then
SetRichPresence("ID: "..miid.." | Players: "..onlinePlayers.." | Standing on "..StreetName)
end
elseif GetVehiclePedIsUsing(PlayerPedId()) ~= nil and not IsPedInAnyHeli(PlayerPedId()) and not IsPedInAnyPlane(PlayerPedId()) and not IsPedOnFoot(PlayerPedId()) and not IsPedInAnySub(PlayerPedId()) and not IsPedInAnyBoat(PlayerPedId()) then
local MPH = math.ceil(GetEntitySpeed(GetVehiclePedIsUsing(PlayerPedId())) * 2.236936)
local VehName = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(GetVehiclePedIsUsing(PlayerPedId()))))
if MPH > 50 then
SetRichPresence("ID: "..miid.." | Players: "..onlinePlayers.." | Speeding down "..StreetName.." in a "..VehName)
elseif MPH <= 50 and MPH > 0 then
SetRichPresence("ID: "..miid.." | Players: "..onlinePlayers.." | Cruising down "..StreetName.." in a "..VehName)
elseif MPH == 0 then
SetRichPresence("ID: "..miid.." | Players: "..onlinePlayers.." | Parked on "..StreetName.." in a "..VehName)
end
elseif IsPedInAnyHeli(PlayerPedId()) or IsPedInAnyPlane(PlayerPedId()) then
local VehName = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(GetVehiclePedIsUsing(PlayerPedId()))))
if IsEntityInAir(GetVehiclePedIsUsing(PlayerPedId())) or GetEntityHeightAboveGround(GetVehiclePedIsUsing(PlayerPedId())) > 5.0 then
SetRichPresence("ID: "..miid.." | Players: "..onlinePlayers.." | Flying over "..StreetName.." in a "..VehName)
else
SetRichPresence("ID: "..miid.." | Players: "..onlinePlayers.." | Landed at "..StreetName.." in a "..VehName)
end
elseif IsEntityInWater(PlayerPedId()) then
SetRichPresence("ID: "..miid.." | Players: "..onlinePlayers.." | Swimming around")
elseif IsPedInAnyBoat(PlayerPedId()) and IsEntityInWater(GetVehiclePedIsUsing(PlayerPedId())) then
local VehName = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(GetVehiclePedIsUsing(PlayerPedId()))))
SetRichPresence("ID: "..miid.." | Players: "..onlinePlayers.." | Sailing around in a "..VehName)
elseif IsPedInAnySub(PlayerPedId()) and IsEntityInWater(GetVehiclePedIsUsing(PlayerPedId())) then
SetRichPresence("ID: "..miid.." | Players: "..onlinePlayers.." | In a yellow submarine")
end
end
end
end)
@@ -1,5 +0,0 @@
Config = {}
Config.Buttons = {
{index = 0,name = 'Website',url = 'https://elite-gaming.co.uk'},
{index = 1,name = 'Connect',url = 'fivem://connect/fivem.eguk.me:30120'}
}
@@ -1,6 +0,0 @@
fx_version 'adamant'
game 'gta5'
shared_script 'Config.lua'
client_script 'Client.lua'
+1 -1
View File
@@ -30,7 +30,7 @@
"maxCallsignLength": 15,
"adminCode": "egrp_police_ADMIN",
"discord": {
"enable": true,
"enable": false,
"token": ""
},
"dutyNotification": true,
+1 -1
View File
@@ -3673,5 +3673,5 @@
"isIllegal": false,
"multiplier": 15,
"itemLocation": 0
},
}
]
+2 -1
View File
@@ -183,7 +183,7 @@ start cvpiv8
start r_pepperspray
#[-----Discord Perms-----]
start RichPresence
start Discord-Presence
start discord_perms
start Badger_Discord_API
start Discord-VehRestriction
@@ -504,6 +504,7 @@ add_ace group.helper jd.staff allow
add_ace group.superadmin hypnonema allow
add_ace group.admin hypnonema allow
add_ace group.moderator hypnonema allow
add_ace group.helper hypnonema allow
# remove the # to hide player endpoints in external log output
sv_endpointprivacy true