Skip to content

配置

配置

BUPA Chat 的配置分散在 shared/config/*.lua 中。所有这些文件都位于 escrow_ignore 中,因此在购买后依然可以进行修改。本页面将介绍通用、显示、表情符号、动作和消息设置。分类和 Discord 拥有各自独立的页面。

通用 — general.lua

按键、音效、默认值和面具系统。

shared/config/general.lua
config.chatKey = "T"            -- 打开聊天输入框的按键
config.chatVisibilityKey = ""    -- 循环切换可见性模式的按键("" = 未绑定)
config.clearCommand = { "clear", "temizle" } -- 清除聊天历史记录的命令
config.closeOnOutsideClick = true            -- 点击外部关闭输入框
config.typingSound = true                    -- 打字时的键盘音效
config.allowNoSlashCommands = true           -- 无需前缀斜杠即可运行命令
config.uiUpdateRate = 24                      -- 头部指示器的毫秒更新率
config.defaultAddTag = true                   -- 未给出标签时,第一个参数将成为标签
config.showPrintsOnChat = false               -- 将服务器控制台打印镜像到聊天中
config.discordTagCacheTime = 60 * 60          -- Discord 角色缓存时间(秒)
config.defaultChatCategory = "command"        -- 打开时默认聚焦的标签页

加入/退出消息遵循标准的 convar:

lua
config.showJoinMessages = GetConvarInt('chat_showJoins', 1) == 0
config.showQuitMessages = GetConvarInt('chat_showQuits', 1) == 0

管理员聊天名称来源

admin 类别可以显示与角色名称不同的名称来源:

shared/config/general.lua
config.adminChatName = {
    mode = "discord",   -- "character" | "steam" | "discord"
    discord = {
        botToken = "",  -- "discord" 模式必需
        guildId  = "",
        cacheTime = 600,      -- 昵称缓存时间(秒)
        fallback  = "steam",  -- 无法解析昵称时使用的备用项
    },
}

感知面具的名称 — config.noneMask

config.noneMask 列出了不应在聊天中隐藏玩家名称的面具可绘制对象(按 ped 模型、集合和索引)。处于激活状态时,戴面具的玩家名称将显示为 Unknown(未知),除非类别设置了 showWearingMask = true,或者所佩戴的面具在此白名单中。

显示 — display.lua

私人消息 — config.pm

shared/config/display.lua
config.pm = {
    active = true,
    command = { "pm", "dm" },     -- 发送私人消息
    webhookKey = "chatMessage",   -- Discord 日志键
    maxLength = 300,
    sender   = { --[[ 发送方副本的 tags/color/name/id/job/discordTag/hour ]] },
    receiver = { --[[ 接收方副本的相同结构 ]] },
}

发送方和接收方各自拥有独立的样式(标签、colorshowPlayerNameshowPlayerIdshowPlayerJobdiscordTagshowHour)。

头部文字与玩家 ID 显示

shared/config/display.lua
config.headTextMaxStack = 4      -- 单个玩家头部堆叠的最大文字数

config.playerIdDisplay = {
    active = false,              -- 聊天打开时在头顶显示 ID
    showOwn = true,             -- 包含你自己的 ID
    dist = 5.0,                 -- 最大显示距离(米)
    template = "[{serverId}] {discordId}", -- {serverId}{name}{steamId}{discordId}{fivemId}
    headText = { bone = 31086, offset = vector3(0.3, 0.0, 0.0), maxRenderDist = 30.0 },
    cssStyle = { color = "#fff", fontSize = "1.8vh", fontWeight = "600" },
}

template 支持占位符 {serverId}{name}{steamId}{discordId}{fivemId}\n 换行符以及内联 HTML/CSS。

表情符号 — emojis.lua

表情符号选择器完全由数据驱动。每个类别格式为 { tab = "<icon emoji>", label = "<HEADER>", list = { ... } },每个表情符号格式为 { emoji, name, code }

shared/config/emojis.lua
config.emojis = {
    {
        tab = "😀", label = "SMILEYS",
        list = {
            { emoji = "😀", name = "Grinning", code = ":grinning:" },
            { emoji = "😂", name = "Joy",      code = ":joy:" },
            -- ...
        },
    },
    -- 手势 (👍)、符号 (❤️)、物品 (🚗)
}

自带四组分类 — 微笑(Smileys)手势(Gestures)符号(Symbols)物品(Objects)。可自由添加、删除或重新排序;code 是预览下方显示的、可搜索的简码。

动作 — emotes.lua

打字指示器 — config.chatOpenEmote

玩家打字时头顶显示的动画点:

shared/config/emotes.lua
config.chatOpenEmote = {
    active = true,
    texts = { { text = "•", time = 500 }, { text = "••", time = 500 }, { text = "•••", time = 500 } },
    cssStyle = { color = "#fff", fontSize = "1.6vh" },
    dist = 8.0,   -- 其他人可见的距离(米)
}
config.emoteOneAt_a_Time = true  -- 每个玩家每种动作命令同时只能有一个处于活动状态

动作命令 — config.emoteCommands

自带 /me/do/dice/zar)和 /rps/tkm)。每个动作都可以播放动画、渲染头部文字,并可选择将其镜像到聊天中:

shared/config/emotes.lua
{
    command = "me",
    desc = "EMOTE_ME_COMMAND_DESC",
    webhookKey = "emoteCommand",   -- Discord 日志(可选)
    dist = 8.0,
    time = 10000,                   -- 头部文字持续时间(毫秒)
    template = "{text}",            -- {text} {playerName} {playerCensoredName}
    cssStyle = { color = "#b6a8ff", fontStyle = "italic" },
    sendToChat = { active = true, tags = { { tag = "ME" } }, color = { 182, 168, 255 } },
}

其他字段:animdictclipflagduration)、headText(骨骼/偏移量/缩放)、params(带帮助键的自定义键入参数)以及用于计算输出的 msgCb(args)(由 /dice/rps 使用)。

消息 — messages.lua

自动广播、欢迎消息和 txAdmin 事件样式 — 默认全部关闭。

config.autoMessages = {
    active = false,
    messages = {
        { interval = 3600000, tags = { { tag = "Auto Message" } }, color = { 88, 166, 255 },
          args = { "Test message for auto message (1)" } },
    },
}

config.welcomeMessages = {
    active = false,
    messages = { { tags = { { tag = "Welcome" } }, color = { 255, 255, 255 },
                   args = { "Welcome to the BUPA Test server!" } } },
}

config.txAdmin = {
    announcement     = { active =