Skip to content

Chat Categorieën

Chat Categorieën

Categorieën zijn de tabbladen in de chat-invoer. Elk tabblad is een afzonderlijk kanaal met eigen kleuren, tags, permissies, bezorgregels en identiteitsbadges. Ze worden gedefinieerd in shared/config/categories.lua als config.chatCategories.

Het ingebouwde Commands tabblad

Een command categorie wordt altijd als eerste tabblad ingevoegd tijdens runtime (vanuit shared/main.lua) — je hoeft dit niet zelf te definiëren:

shared/main.lua
table.insert(config.chatCategories, 1, {
    label = "CATEGORY_COMMANDS_LABEL",
    type = "command",
    icon = "terminal",
    placeholder = "CATEGORY_COMMANDS_PLACEHOLDER",
})

Alles wat in dit tabblad wordt getypt, wordt uitgevoerd als een commando. Met config.allowNoSlashCommands = true werkt een bekend commandonaam met of zonder een voorloopslash (het typen van me hoi voert /me hoi uit).

Wat standaard ingeschakeld is

Direct uit de doos is alleen de Admin categorie actief in config.chatCategories. Kant-en-klare voorbeelden voor OOC (Globaal), OOC (Lokaal/dichtstbijzijnde), Politie, EMS en Gang zijn in het bestand opgenomen maar uitgeschakeld als commentaar — haal ze uit het commentaar en pas ze naar wens aan.

Categorie type Hoe toegang wordt gereguleerd
Commands command Altijd aanwezig (automatisch ingevoegd)
Admin admin ACE-permissies command / admin / adminchat
OOC (Globaal) ooc Open voor iedereen (voorbeeld)
OOC (Lokaal) oocclosest Nabijheid — distance in meters (voorbeeld)
Politie pdchat jobs = { police = {...grades} } (voorbeeld)
EMS emschat jobs = { ambulance = true } (voorbeeld)
Gang gang gangs = { ... } (voorbeeld)

Standaard categorie

config.defaultChatCategory bepaalt welk tabblad geselecteerd is wanneer de chat opent:

shared/config/general.lua
config.defaultChatCategory = "command"

Slash versus geen-slash commando's

shared/config/general.lua
--- true  = commando's werken MET en ZONDER voorloopslash ("me hoi" voert /me uit)
--- false = commando's activeren alleen met een voorloopslash ("/me hoi")
config.allowNoSlashCommands = true

Categorie parameters

Elke categorie ondersteunt een rijke set aan velden. Een ingekort voorbeeld:

shared/config/categories.lua
{
    label = "CATEGORY_ADMIN_LABEL",  -- vertaalsleutel voor de tabnaam
    type = "admin",                  -- unieke id voor deze categorie
    icon = "shield-alt",             -- FontAwesome icoon
    webhookKey = "chatMessage",      -- Discord log webhook (zie Discord Logging)
    placeholder = "CATEGORY_ADMIN_PLACEHOLDER",
    permissions = { "command", "admin", "adminchat" }, -- vereiste ACE perms
    maxLength = 500,                 -- maximale berichtlengte
    tags = {                         -- vaste tag(s) getoond voor het bericht
        { tag = "Admin", textColor = { 51, 51, 51 }, bgColor = { 255, 105, 97 } },
    },
    color = { 255, 105, 97 },        -- standaard tekstkleur van bericht
    showPlayerName = { active = true, censored = false, showWearingMask = true },
    showPlayerId   = { active = false, type = "serverId" },
    showPlayerJob  = { active = false, showLabel = true, showGrade = false },
    discordTag     = { active = false, maxShow = 1, roles = { ... } },
    showHour       = { active = true },
}

Volledige veldreferentie (alles optioneel tenzij anders vermeld):

Veld Type Beschrijving
label string Vertaalsleutel voor de weergavenaam van het tabblad
type string Vereist. Unieke identificatie voor de categorie
icon string FontAwesome icoon naam
webhookKey string Discord webhook sleutel om de berichten van deze categorie te loggen
command string / string[] Chatcommando('s) die naar deze categorie routeren
placeholder string Vertaalsleutel voor de invoer placeholder
distance number Maximale bezorgingsafstand in meters; weglaten voor globaal
maxLength number Maximale lengte van een bericht in tekens
permissions string[] Vereiste ACE-permissies om de categorie te zien/gebruiken
jobs table Vereiste banen — true = alle graden, number[] = specifieke graden
gangs table Vereiste gangs — zelfde structuur als jobs
tags table[] Vaste tags getoond voor berichten (tag, textColor, bgColor)
color RGB Standaard tekstkleur van bericht { r, g, b }
showPlayerName table active, censored, bgColor, textColor, showWearingMask
showPlayerId table active, type = "serverId", kleuren
showPlayerJob table active, showLabel, showGrade, kleuren, per-baan overschrijvingen
discordTag table active, maxShow, roles[] (Discord rol → tag)
showHour table active, kleuren — voegt de berichttijd toe

Naamcensurering toont een gemaskeerde naam (bijv. J*** D**). Als een speler een masker draagt, wordt zijn naam verborgen als Onbekend tenzij showWearingMask = true — de maskercontrole wordt aangestuurd door config.noneMask in general.lua.