Bugün 20% tasarruf edin Ödemede WELCOME kodunu kullanın. WELCOME

FiveM Whitelist — Complete Guide (txAdmin, Scripts, DB)

Ücretsiz bir komut dosyasını mı test ediyorsunuz?

Hızlı kontroller için ücretsiz komut dosyaları uygundur. Üretim sunucuları için, çerçeveye ve kullanım senaryosuna göre tam sunucu paketlerini veya ücretli, bakımı yapılan komut dosyalarını karşılaştırın.

A whitelist in FiveM is an access-control mechanism that restricts server entry to pre‑approved players, matched by their unique identifiers (Rockstar license, Steam ID, Discord ID, etc.). Below is a production‑ready guide covering txAdmin’s built‑in whitelist, script patterns, database storage, and reliability notes.


TL;DR Options Matrix

ModeWhere to setWhat it checksEn iyisi içinNotlar
Approved LicensetxAdmin → Settings → Player Manager → Whitelist Modelisans: (Rockstar)Most serversSimple, reliable; manual approvals or pre‑approvals supported
Discord MembertxAdmin (Discord linked)anlaşmazlık: is guild memberCommunities centered on UyuşmazlıkNon‑Discord users blocked
Discord RoletxAdmin (Discord linked)anlaşmazlık: has specific roleRole‑gated access (donor, staff)Combine with role automations
Admin‑onlytxYöneticisiAdmins onlyMaintenance/dev nightsEffectively locks server, not recommended
Custom ScriptLua/JS resourceAny identifiers you wantGranular rules & UXNeeds code + upkeep

Tavsiye: Kullanmak Approved License for the baseline (everyone has a Rockstar license), then add Discord Role as an extra gate for special tiers.


How to Enable & Operate Whitelist in txAdmin

Ön koşullar

  • txAdmin running (shipped with FXServer).
  • For Discord modes: Discord integration configured (bot invited, guild/role selected).

Enable whitelist

  1. Açık txAdmin → Settings → Player Manager.
  2. Ayarlamak Whitelist Mode to one of: Approved License, Discord Member, Discord Role, veya Admin‑only.
  3. Set a Rejection Message, e.g.:
    Not whitelisted. Apply at discord.gg/yourinvite
  4. Save.

Approve players (two flows)

  • Passive (queue): When a non‑approved player tries to join, a request appears under Beyaz liste. Approve/deny with one click.
  • Active (pre‑approve): Git Whitelist → Add Approval and paste an identifier in the form type:value, e.g.
    • license:110000112345678
    • steam:11000010abcdef0
    • discord:123456789012345678

Revoke

  • Açık Oyuncular veya Beyaz liste ve tıkla Revoke next to the approval.

Tips

  • Tercih etmek license identifiers for baseline access (universally present).
  • Seninkini sakla rejection message actionable (Discord link + basic rules + ticket CTA).
  • For staff/devs, stack requirements: e.g., must be license + discord role.

Technical Implementation Details

Whitelists run during the connection deferral stage. The server inspects the player’s identifier set and accepts or rejects before resources load. This keeps load low and blocks non‑approved players early.

Identifier Types (reliability)

  • lisans: (Rockstar) — stable, tied to game purchase; recommended primary key.
  • buhar: — present only if Steam runs; can be missing if players do not use Steam.
  • anlaşmazlık: — present only if Discord runs and your server reads it.
  • ip: — dynamic; use for telemetry/rate‑limit, not identity.

Minimal Whitelist Script (deferrals UX + multi‑ID)

-- resource: simple-whitelist
-- fxmanifest.lua should include '@oxmysql/lib/MySQL.lua' if you use DB code below.

local STATIC_WHITELIST = {
    ["license:110000112345678"] = true,
    ["steam:11000010abcdef0"] = true,
    ["discord:123456789012345678"] = true,
}

local function collectIdentifiers(src)
    local ids = {}
    for _, id in ipairs(GetPlayerIdentifiers(src)) do ids[id] = true end
    return ids
end

AddEventHandler("playerConnecting", function(name, setKickReason, deferrals)
    local src = source
    deferrals.defer()
    deferrals.update(("Checking whitelist for %s..."):format(name))

    local ids = collectIdentifiers(src)

    -- Require at least a Rockstar license in all cases
    local hasLicense = false
    for id, _ in pairs(ids) do
        if id:sub(1, 8) == "license:" then hasLicense = true break end
    end
    if not hasLicense then
        return deferrals.done("You must start the game normally (Rockstar license missing). Restart and try again.")
    end

    -- Static allowlist quick‑path
    for id, _ in pairs(ids) do
        if STATIC_WHITELIST[id] then
            return deferrals.done()
        end
    end

    -- Fallback: not approved
    return deferrals.done("Not whitelisted. Apply at discord.gg/yourinvite")
end)

Kullanmak deferrals.update to show progress messages while you check IDs and/or a database. This reduces false “timeout” reports.


Database‑Driven Whitelist (oxmysql, production‑ready)

Schema

CREATE TABLE IF NOT EXISTS whitelist (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  identifier VARCHAR(64) NOT NULL,
  note VARCHAR(120) NULL,
  added_by VARCHAR(64) NULL,
  added_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id),
  UNIQUE KEY u_identifier (identifier)
);

Server‑side check (oxmysql)

-- Requires oxmysql. Add to fxmanifest: '@oxmysql/lib/MySQL.lua'
AddEventHandler('playerConnecting', function(name, setKickReason, deferrals)
    local src = source
    deferrals.defer()
    deferrals.update('Verifying whitelist...')

    local ids = {}
    for _, id in ipairs(GetPlayerIdentifiers(src)) do table.insert(ids, id) end

    -- Single scalar: any identifier approved?
    local rowCount = MySQL.scalar.await(
        'SELECT COUNT(*) FROM whitelist WHERE identifier IN (?)',
        { ids }
    )

    if rowCount and rowCount > 0 then
        return deferrals.done()
    else
        return deferrals.done('Access denied. Apply at discord.gg/yourinvite')
    end
end)

Admin QoL commands (örnek)

RegisterCommand('wladd', function(src, args)
    if src ~= 0 then return end -- console only for simplicity
    local identifier = args[1]
    if not identifier or not identifier:find(':') then
        print('Usage: wladd identifierType:identifierValue')
        return
    end
    local ok = MySQL.prepare.await('INSERT IGNORE INTO whitelist (identifier,note,added_by) VALUES (?, ?, ?)', {
        identifier, 'manual add', 'console'
    })
    print(ok and ('Whitelisted: %s'):format(identifier) or 'Failed to add')
end, true)

RegisterCommand('wlrm', function(src, args)
    if src ~= 0 then return end
    local identifier = args[1]
    local ok = MySQL.prepare.await('DELETE FROM whitelist WHERE identifier = ?', { identifier })
    print(ok and ('Removed: %s'):format(identifier) or 'Failed to remove')
end, true)

İçin mysql-async, replace MySQL.scalar.await ile MySQL.Async.fetchScalar and the parameter style with @param/?. Prefer oxmysql for performance & await support.

Performans

  • Keep a UNIQUE index Açık identifier (see schema).
  • Optionally warm a memory cache at startup and on change; hit DB only on cache miss.
  • Rate‑limit repeated failed connection attempts by license/IP.

Multi‑Identifier Rules

Some servers require multiple IDs (e.g., both Steam and Discord) for staff tiers. Example pattern:

local function hasType(ids, typ)
    for id, _ in pairs(ids) do if id:sub(1, #typ+1) == (typ..':') then return true end end
    return false
end

-- Require license, and if staff, also discord
if not hasType(ids, 'license') then
    return deferrals.done('Start the game normally (license missing).')
end
if staffModeEnabled and not hasType(ids, 'discord') then
    return deferrals.done('Join our Discord and link your account to enter.')
end

Using Discord as the Whitelist (no custom code)

If your community runs on Discord, use txAdmin’s Discord Member veya Discord Role modes:

  • Link txAdmin to your Discord guild.
  • Seçmek Discord Member to allow any guild member, or Discord Role to gate by a specific role (e.g., @Whitelisted).
  • Kale Approved License as a second gate if you want both conditions.

Best practice: bir tane bakım #whitelist-requests channel + lightweight form. Automate role assignment after approval via a bot or moderation flow.

FAXES: A Discord Whitelist System for FiveM


Integration Ideas

  • Discord bots: auto‑approve when a user completes an application, boosts, or subscribes.
  • Web panel: staff add/remove identifiers, with audit trail.
  • Paid tiers: grant discord role via your store (Tebex/Patreon) and let txAdmin role‑mode enforce access.

Troubleshooting & Gotchas

  • Player not showing in txAdmin requests: Ensure whitelist is enabled in the correct profile; check that the player actually reached the deferral stage (watch txAdmin live console).
  • Steam ID missing: Steam must be running; don’t key your whitelist solely on buhar:. Prefer lisans:.
  • Discord ID missing: User must have Discord running and your server must be set up to read anlaşmazlık:; verify Discord integration.
  • license vs license2: Some frameworks record two license fields; make sure your migration/DB queries consider both when moving data.
  • Deferral timeouts: Always call deferrals.update(...) while you await DB; respond within ~10–15 seconds.
  • Mismatched identifier format: Ensure you paste type:value exactly (lowercase type, colon separator).
  • High traffic spikes: Cache whitelist in memory, pre‑warm at start, and debounce DB calls.

SEO FAQ (Schema‑ready content)

What is the best identifier for FiveM whitelist?
The Rockstar lisans: is the most universal and reliable; use it as your primary key.

Can I whitelist with Discord without coding?
Yes. txAdmin supports Discord Member Ve Discord Role whitelist modes once Discord is linked.

Do I need Steam for whitelist?
No. Many players don’t run Steam; avoid making buhar: mandatory for baseline access.

Can I combine multiple checks (e.g., license + Discord role)?
Yes. Use txAdmin role mode Ve retain a license check in your custom script or admissions flow.

How do I pre‑approve players?
txAdmin → Whitelist → Add Approval, yapıştır identifierType:identifier (örneğin, license:...).


Copy‑Paste Rejection Messages (use your brand)

  • Queue‑based: You’re not whitelisted yet. Apply in #whitelist-requests → discord.gg/yourinvite
  • Role‑gated: Your Discord account doesn’t have @Whitelisted. Join discord.gg/yourinvite and request access.
  • Bakım: Server is in Admin‑only mode for maintenance. Please try again later.

Çözüm

A FiveM whitelist validates player identifiers during the connection deferral phase and blocks unapproved users before resources load. For most servers, enable Approved License in txAdmin, optionally layer Discord Role for community gating, and use a DB‑backed list with caching for scale.


Appendix: Original Minimal Example (for reference)

-- server.lua yerel beyaz liste = { ["steam:110000132456789"] = true, ["license:abc123def456789"] = true, ["discord:123456789012345678"] = true } AddEventHandler("playerConnecting", function(name, setKickReason, deferrals) yerel oyuncu = kaynak yerel tanımlayıcılar = GetPlayerIdentifiers(player) yerel beyaz listeli = false deferrals.defer() for _, id in pairs(identifiers) do if whitelist[id] then whitelisted = true break end end if not whitelisted then deferrals.done("Beyaz listeye eklenmemiş. Başvurunuzu şu adresten yapın: your-discord.gg/invite") else deferrals.done() end end)
Luka
Luka

Ben Luke, bir oyuncuyum ve FiveM, GTA ve rol yapma hakkında yazmayı seviyorum. Bir rol yapma topluluğu yönetiyorum ve sunucuları yönetme konusunda yaklaşık 10 yıllık deneyimim var.

Articles: 436

Leave a Reply