This script allows users to be notified via both an in-game command and a Discord command to come to support.
-
In-Game Notification: Supporters can summon players directly using their player ID. The summoned player receives a corresponding notification in both Discord and the game.
-
Discord Notification: Supporters can call Discord users to support using either their Discord ID or in-game ID. If the player is online, they will also receive an in-game notification.
-
Discord Renaming: The script includes a feature that allows players to be renamed in Discord according to their in-game character name, facilitating identification in support. This feature can be disabled if needed.
This script enhances communication between players and supporters, optimizing the support process within your FiveM community.
-- SharedConfig for Server and Client
SharedConfig = {}
SharedConfig.ESXTrigger = function()
local ESX = nil
--ESX = exports["es_extended"]:getSharedObject()
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
return ESX
end
SharedConfig.Debug = false
SharedConfig.KeyTimeout = 10 --seconds
SharedConfig.RefreshRenameCommand = "refreshrename"
SharedConfig.Notify = function(source, message)
if source == nil then
TriggerEvent('Novel_Notify:SendNotify', 'fa-solid fa-info', 'Novel AdminBot', message, '#0000ff', 10)
return
end
TriggerClientEvent('Novel_Notify:SendNotify', source, 'fa-solid fa-info', 'Novel AdminBot', message, '#0000ff', 10)
end
SharedConfig.Localse = {
["DiscordIsNeeded"] = "Your Discord must be running to play on the server",
["MissingPlayerId"] = "The player ID is required",
["MissingRights"] = "You do not have the required rights!",
["RenameTimeout"] = "You can only execute the command every 5 minutes",
["PlayerIsNotOnline"] = "The player is not online"
}
-- Server Config
ServerConfig = {}
ServerConfig.ForceDiscord = true
ServerConfig.CommandName = "cp"
ServerConfig.AdminGroup = {
"superadmin",
"admin"
}
ServerConfig.SelectUsernameFromDb = function (playerId)
local result = MySQL.Sync.fetchAll("SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = @identifier", {
["@identifier"] = GetPlayerLicense(playerId, "license")
})
if result == nil or #result == 0 then
return ""
end
return result[1].firstname .." ".. result[1].lastname
end
Bot Config:
{
"Token": "bot_token",
"UseDiscordRenamer": true,
"PlayerDiscordMessage": {
"Author": "Novel-Dev",
"Title": "You have been asked to come to support.",
"Body": "The support {0} has requested you in the support area! Please report there in the next 2 minutes.",
"Img": "https://cdn.discordapp.com/attachments/886897611703996446/1161401553987584111/Novel_Logo_V2.png?ex=66b08ebc&is=66af3d3c&hm=19c0e4a8722a52a4056fe8100a6d12d87724ea53459b2f2039ccf01b8184a805&",
"Color": "0x0099FF"
},
"AdminRole": "your_admin_role_id",
"ComamndChannel": "your_command_channel_id",
"AllowCommandsOnlyInCommandChannel": false
}
Code is accessible | No |
Subscription-based | No |
Lines (approximately) | 400 |
Requirements | ESX, Yarn(its default in FiveM) |
Support | Yes |