Hello, there has been a lot of talk lately about the possability of pictures in rich presence. I use this script:
But that script has not integrated possability for pictures. I have tried to add it in the code myself, and I end up with that it connects to the bot, but the picture is not appearing. Here is the client.lua and I was wondering if someone could help me add the picture code, so it works.
Old code
local WaitTime = 10000 -- How often do you want to update the status (In MS)
Citizen.CreateThread(function()
while true do
--This is the Application ID (Replace this with you own)
SetDiscordAppId('ID')
--Here you will have to put the image name.
SetDiscordRichPresenceAsset('tgal.png')
local x,y,z = table.unpack(GetEntityCoords(PlayerPedId(),true))
local StreetHash = GetStreetNameAtCoord(x, y, z)
Citizen.Wait(WaitTime)
if StreetHash ~= nil then
StreetName = GetStreetNameFromHashKey(StreetHash)
if IsPedOnFoot(PlayerPedId()) and not IsEntityInWater(PlayerPedId()) then
if IsPedSprinting(PlayerPedId()) then
SetRichPresence("Sprinting down "..StreetName)
elseif IsPedRunning(PlayerPedId()) then
SetRichPresence("Running down "..StreetName)
elseif IsPedWalking(PlayerPedId()) then
SetRichPresence("Walking down "..StreetName)
elseif IsPedStill(PlayerPedId()) then
SetRichPresence("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("Speeding down "..StreetName.." In a "..VehName)
elseif MPH <= 50 and MPH > 0 then
SetRichPresence("Cruising down "..StreetName.." In a "..VehName)
elseif MPH == 0 then
SetRichPresence("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("Flying over "..StreetName.." in a "..VehName)
else
SetRichPresence("Landed at "..StreetName.." in a "..VehName)
end
elseif IsEntityInWater(PlayerPedId()) then
SetRichPresence("Swimming around")
elseif IsPedInAnyBoat(PlayerPedId()) and IsEntityInWater(GetVehiclePedIsUsing(PlayerPedId())) then
local VehName = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(GetVehiclePedIsUsing(PlayerPedId()))))
SetRichPresence("Sailing around in a "..VehName)
elseif IsPedInAnySub(PlayerPedId()) and IsEntityInWater(GetVehiclePedIsUsing(PlayerPedId())) then
SetRichPresence("In a yellow submarine")
end
end
end
end)
I have tried, but it doesnāt work having two resources to control rich presence. They just āargueā with each other. I have tried following the tutorial but itās not working.
Wut. You donāt create a second resource. just add the logic (which is literally just setting a native) to your script. It looks like you did that already, but what you havenāt showed or might not have done is added the asset to your Discord application and/or used the correct manifest version. Or maybe you are way behind on server artifacts
Yeah, the reason images werent implemented is because when i originally created the resource, it wasnt possible to use a custom discord application, i may change that sometime, not sure
local WaitTime = 10000 -- How often do you want to update the status (In MS)
local appid = 'id' -- Make an application @ https://discordapp.com/developers/applications/ ID can be found there.
local asset = 'image name' -- Go to https://discordapp.com/developers/applications/APPID/rich-presence/assets
function SetRP()
local name = GetPlayerName(PlayerId())
local id = GetPlayerServerId(PlayerId())
SetDiscordAppId(appid)
SetDiscordRichPresenceAsset(asset)
end
Citizen.CreateThread(function()
SetRP()
while true do
local x,y,z = table.unpack(GetEntityCoords(PlayerPedId(),true))
local StreetHash = GetStreetNameAtCoord(x, y, z)
Citizen.Wait(WaitTime)
SetRP()
if StreetHash ~= nil then
StreetName = GetStreetNameFromHashKey(StreetHash)
if IsPedOnFoot(PlayerPedId()) and not IsEntityInWater(PlayerPedId()) then
if IsPedSprinting(PlayerPedId()) then
SetRichPresence("Sprinting down "..StreetName)
elseif IsPedRunning(PlayerPedId()) then
SetRichPresence("Running down "..StreetName)
elseif IsPedWalking(PlayerPedId()) then
SetRichPresence("Walking down "..StreetName)
elseif IsPedStill(PlayerPedId()) then
SetRichPresence("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("Speeding down "..StreetName.." In a "..VehName)
elseif MPH <= 50 and MPH > 0 then
SetRichPresence("Cruising down "..StreetName.." In a "..VehName)
elseif MPH == 0 then
SetRichPresence("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("Flying over "..StreetName.." in a "..VehName)
else
SetRichPresence("Landed at "..StreetName.." in a "..VehName)
end
elseif IsEntityInWater(PlayerPedId()) then
SetRichPresence("Swimming around")
elseif IsPedInAnyBoat(PlayerPedId()) and IsEntityInWater(GetVehiclePedIsUsing(PlayerPedId())) then
local VehName = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(GetVehiclePedIsUsing(PlayerPedId()))))
SetRichPresence("Sailing around in a "..VehName)
elseif IsPedInAnySub(PlayerPedId()) and IsEntityInWater(GetVehiclePedIsUsing(PlayerPedId())) then
SetRichPresence("In a yellow submarine")
end
end
end
end)
godgutten i want to remove the thing with street and vehicle can you send me the code for that,i tried to remove the thing with street vehicle and i can tā¦