Skip to the content
Docs

Cxc_gamertag

On this page3

Open source, CC BY-NC 4.0. It exposes three client exports: GamerTag(bool), Dead(bool) and Mask(bool) — all about the target, none about the viewer. So it can take our "this face is covered" signal out of the box, and needs a few lines from you for per-viewer names.

We do not ship or modify their code, and their licence forbids reusing it in a paid resource. Everything below is either our own config switch or a snippet you paste into their file yourself.

1. Masked faces — no code at all

In 5code-recognition/config.lua:

lua
Config.NametagSystem = 'cxc_gamertag'

bridge/nametag_client.lua then calls exports.cxc_gamertag:Mask(true) the moment the local player's face becomes covered (face coverage at or above Config.FaceCoverage.HiddenAt, default 60 % — a full mask or a bandana counts, a cap and sunglasses do not) and Mask(false) when it is uncovered again. It also calls Mask(false) if 5code-recognition stops, so nobody is left permanently masked by a signal of ours.

If you renamed their export

cxc_gamertag lets you rename its exports in their config (ExportGamerTagName, ExportDeadName, ExportMaskName). If you changed ExportMaskName, change the matching line in our open bridge — it is the only place the name appears:

lua
-- bridge/nametag_client.lua, in NametagBridge.OnSelfConcealment
exports.cxc_gamertag:Mask(faceHidden)          -- <- rename Mask here

We print a one-off warning in the console if the call fails.

2. Per-viewer names — a small patch in their client

cxc_gamertag has no per-viewer concept: it draws one tag for everybody. Add the push cache to their client file and use it where they build the tag text.

lua
-- === 5code-recognition link (cxc_gamertag client) =====================
local recogKnown = {}
local RECOG_MIN_PCT = 80   -- = Config.Scoring.ActThreshold

AddEventHandler('5code-recognition:client:onRecognitionChanged', function(sid, info)
    if info and (tonumber(info.pct) or 0) >= RECOG_MIN_PCT then
        recogKnown[sid] = info.introducedName or info.label
    else
        recogKnown[sid] = nil
    end
end)

AddEventHandler('onResourceStop', function(res)
    if res == '5code-recognition' then recogKnown = {} end
end)

--- The text to draw above `player`, or nil to draw nothing.
function RecogTagFor(player)
    return recogKnown[GetPlayerServerId(player)]
end
-- === end 5code-recognition link =======================================

Then, where they compose the tag, prefer our answer:

lua
local name = RecogTagFor(player) or 'Stranger'

Leave their ID / job / dead-icon logic alone — only the name is ours.

3. What not to do

  • Do not call exports['5code-recognition']:GetRecognitionLabel(sid) from their draw loop. Their loop runs every frame for every player in range; a serialized cross-resource call there costs time on every frame. Use the cache above.
  • Do not copy recogKnown into a state bag so their server can read it. That would tell every client who knows whom.