Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: drp and pause menu text #239

Merged
merged 6 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions client/discord.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
AddStateBagChangeHandler('PlayerCount', nil, function(bagName, _, value)
if bagName ~= 'global' or not value then return end
local players = 'Players %s/' .. Config.MaxPlayers
SetRichPresence((players):format(value))
end)

SetDiscordAppId(Config.Discord.AppId)
SetDiscordRichPresenceAsset(Config.Discord.LargeIcon.icon)
SetDiscordRichPresenceAssetText(Config.Discord.LargeIcon.text)
SetDiscordRichPresenceAssetSmall(Config.Discord.SmallIcon.icon)
SetDiscordRichPresenceAssetSmallText(Config.Discord.SmallIcon.text)
SetDiscordRichPresenceAction(0, Config.Discord.FirstButton.text, Config.Discord.FirstButton.link)
SetDiscordRichPresenceAction(1, Config.Discord.SecondButton.text, Config.Discord.SecondButton.link)
4 changes: 4 additions & 0 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,7 @@ end)
lib.callback.register('qbx_core:client:setHealth', function(health)
SetEntityHealth(cache.ped, health)
end)

local mapText = Config.Server.PauseMapText
if mapText == '' or type(mapText) ~= 'string' then mapText = 'FiveM' end
AddTextEntry('FE_THDR_GTAO', mapText)
20 changes: 20 additions & 0 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,29 @@ Config.Server.PVP = true -- Enable or disable pvp on the server (Ability to shoo
Config.Server.Discord = "" -- Discord invite link
Config.Server.CheckDuplicateLicense = true -- Check for duplicate rockstar license on join
Config.Server.Permissions = { 'god', 'admin', 'mod' } -- Add as many groups as you want here after creating them in your server.cfg
Config.Server.PauseMapText = 'Powered by Qbox' -- Text shown above the map when ESC is pressed. If left empty 'FiveM' will appear

Config.NotifyPosition = 'top-right' -- 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left'

Config.Discord = {} -- Discord Rich Presence config
Config.Discord.AppId = '' -- This is the Application ID (Replace this with you own)
Config.Discord.LargeIcon = { -- To set this up, visit https://forum.cfx.re/t/how-to-updated-discord-rich-presence-custom-image/157686
icon = 'logo_name', -- Here you will have to put the image name for the 'large' icon.
text = 'This is a large icon with text', -- Here you can add hover text for the 'large' icon.
}
Config.Discord.SmallIcon = {
icon = 'logo_name', -- Here you will have to put the image name for the 'small' icon.
text = 'This is a small icon with text', -- Here you can add hover text for the 'small' icon.
}
Config.Discord.FirstButton = {
text = 'First Button!',
link = 'fivem://connect/localhost:30120',
}
Config.Discord.SecondButton = {
text = 'Second Button!',
link = 'fivem://connect/localhost:30120',
}

---@alias TableName string
---@alias ColumnName string

Expand Down
1 change: 1 addition & 0 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ client_scripts {
'client/loops.lua',
'client/events.lua',
'client/character.lua',
'client/discord.lua',
'bridge/qb/client/drawtext.lua',
'bridge/qb/client/events.lua',
}
Expand Down
Loading