Studios
XP Systemhouse-3.jpg

Examples

SoonXP SystemQBCore · Qbox · ESX
PAGE 04 OF 06  ·  CONFIGURATION → EXAMPLES → TROUBLESHOOTINGdocs.glitchstudios.dev
Browse docs
flowchart LR
    J["Jobs and crimes(other resources)"] -->|AddPlayerXP| X["XP cacheper character"]
    X -->|"perks + boosters"| M["Multiplier"]
    X -->|"batched upsert"| D[("player_xp")]
    X -->|updateXP| C["Clientpopup + menu"]
    S["Skill trees"] --> D2[("player_skills")]
    B["Boosters"] --> D3[("xp_boosts")]
    F["Framework bridgeQbox / qb / ESX / standalone"] -.-> X

The server holds each character's XP in memory, tagged with the identifier it belongs to. A change marks the character dirty, and the blob is written every Config.SaveInterval seconds (10 by default). It is also written on drop, logout and character switch, and on resource stop, where the writes are awaited. A failed write is retried. When a different character turns up on the same server id, the old cache is saved and dropped before the new one loads. Loads that run at the same time share one query.

The bridges in bridge/ give the rest of the code one identifier, character name, job and bank payment, whatever the framework.

Architecture notes#

Area Where Notes
XP server/xp.lua Cache, batched saves, load events and exports. The one-time migrations at the top are KVP-gated and find nothing to change on a fresh server.
Skills server/skills.lua Perks, effects, daily uses, auras, the leaderboard and the menu callbacks (rate limited per player).
Boosters server/boosts.lua Personal and server-wide boosts, pausing, expiry warnings, the item export and the webhook.
Admin server/admin.lua, client/admin.lua One lib.callback action dispatcher that checks the ace on every call.
Bridges bridge/<framework>/ GetIdentifier, GetCharacterName, GetJobName, RemoveMoney, notifications and load/unload events.
NUI nui/ Skills drawer, admin drawer and the XP sweep bar.
Guard fxmanifest.lua Glitch'd loads the glitch-poolcleaning net event guard first. Client helpers marked -- gs45 are anti-cheat bait with no handler on purpose. Leave them in.