RDE_CREW DOCS
RED DRAGON ELITE // PLAYER SYSTEMS

Real Ink.
On a Real Wall. For Real.

rde_crew is a production-grade crew/gang and territory-control system for ox_core. Territory is claimed by physically standing at a wall and freehand-painting your tag with the mouse — the result renders as an actual flat 3D object stuck to that wall, visible to every nearby player, contested through declared wars.

01 / Start Here

Overview

Crews are created, ranked, and permissioned through ox_core characters — not a separate identity layer. Territory is real, in-game-editable polygon zones, claimed not by an admin spreadsheet but by freehand-painting a tag, then rotating and scaling it directly on the wall surface before confirming placement.

Core Principle Everything syncs through prefixed statebags and a lightweight GlobalState index. Heavy data — the actual graffiti artwork — is only ever sent to a client once they're physically close enough to render it.

Why this over other crew/gang scripts

Other Crew/Gang Scriptsrde_crew
Territory tag = a fixed font string stamped on the wallReal freehand painting — your mouse, your lines, your tag
Zones hardcoded as lat/long boxes in a config fileIn-game polygon zone editor — walk the perimeter, save
Minimap zone colors update on reconnect or restartLive DUI pipe — zone turns crew color instantly, for everyone
Permissions = "admin" or "not admin"9 granular permission flags per grade, up to 8 grades
02 / Start Here

Quick Start

server.cfg
ensure oxmysql
ensure ox_lib
ensure ox_core
ensure ox_target
ensure rde_crew

-- OrgBridge: rde_organizations must start BEFORE rde_crew
Required addon bzzz_decals — a free third-party prop pack with confirmed real alpha-blended materials — is required for graffiti rendering. It's streamed from rde_crew/stream/, no separate download needed.

Define each spray can color as a normal ox_inventory item, then add one line per color to Config.Territory.sprayCans. All tables auto-create on first start.

03 / Reference

Graffiti — Real Freehand Painting

A two-screen NUI flow. Screen 1 — Draw: freehand canvas, pick from carried spray cans and one of 7 authentic cap types. Finished strokes bake once onto an offscreen buffer — cost stays flat no matter how detailed the piece. Screen 2 — Place: rotate and scale the finished piece directly on a simulated wall surface before confirming.

CapWidthEdge
Skinny2pxCrisp — hairline precision
NY Cap8pxCrisp — the classic outline cap
Fat Cap20pxFeathered — fills
Ultrawide50pxMaximum spread — banana cap

The finished canvas exports as a real PNG with genuine alpha transparency. CreateRuntimeTextureFromImage applies it directly to the bzzz_decals carrier prop — a real flat 3D object with real transparency, physically stuck to the wall. A full orthonormal basis (SetEntityMatrix) places it flush on any wall regardless of angle.

04 / Reference

Territory & Zones

In-game polygon zone editor — walk the perimeter, place corners live, persist to DB, edit any time. Zone ownership is computed by last_spray or spray_count, and war-gated: an enemy crew can only overspray your owned zone while an active war exists between both crews. Ownership changes broadcast instantly via per-zone statebags, and the minimap DUI texture updates in the same frame — no rebuild, no delay.

config.lua
Config.Territory = {
    sprayMaxDistance       = 3.0,
    takeoverRule           = 'last_spray',   -- or 'spray_count'
    requireWarToOverspray  = true,
}
05 / Reference

OrgBridge — rde_organizations Integration

rde_organizations becomes the HR layer (who's in a crew, what rank, what permissions), rde_crew stays the territory layer (which zone a crew owns, where their graffiti is, active wars). Neither resource needs to know the other exists — the bridge is invisible glue.

Action in rde_organizationsResult in rde_crew
Create a gang / MC / criminal orgCrew auto-created and linked
Rank changed (promote/demote)Crew grade updated instantly
Org disbandedCrew dissolved, graffiti cascade-deleted

Standalone mode: set Config.OrgBridge.enabled = false and rde_crew runs exactly as before — boss NPC, /crew menu, manual management. The bridge is purely additive.

06 / Reference

Security

Every spray placement validated server-side: image format, size cap, every can verified against the real registry
Zone lookup at placement time is always server-computed — client-claimed zone names are never trusted
Rotation and scale values from the NUI are range-clamped server-side before being written to DB
War-gate enforced server-side before any overspray is accepted
07 / More

🩸 The Graffiti Saga: A War Story

Every config comment in this resource that starts with "CONFIRMED IN TESTING" or "BUGFIX" is a scar from one overnight session. The plan was simple: player draws on a canvas, art gets projected onto the wall as a decal. A weekend feature, surely.

RoundWhat happened
1 — AddDecalGTA's native bullet-hole system, repurposed. IsDecalAlive returned true. Nothing visible on the wall — a known, undocumented Rockstar issue. Abandoned.
2 — AddReplaceTextureA real prop (prop_ld_filmset) via manual asset hunting. Ran without error. Still showed the original art, never the custom texture.
3 — Root cause foundGitHub issue citizenfx/fivem#1684: AddReplaceTexture doesn't support DUI-sourced textures on any branch except Release. This server runs latest.
4–5 — Rebuild + retryRebuilt the pipeline around a base64 PNG instead of a DUI browser. Retried AddDecal with a non-DUI source. Same result, twice.
6–11Named render targets, cinema screen props, a database table found wiping itself on every boot, race conditions, parallelogram distortion, and a prop whose embedded texture name turned out to be prop_fruit_box_01.
12 — bzzz_decalsA free third-party addon prop pack with a confirmed real alpha-blended material, verified in OpenIV before integrating a single file. It worked. Real ink, on a real wall.
Final tally Three full rendering techniques attempted, two abandoned, one official CitizenFX engine bug identified and worked around, one self-inflicted database table found wiping itself on every boot, two race conditions, one third-party addon pack integrated from scratch.
08 / More

Common Pitfalls

Zone color race condition

AddStateBagChangeHandler fires with new ownership data as the value parameter — but GlobalState[key] read inside the handler returns the old/nil value.

Fix (v2.0.1): use value.ownerCrewId directly, passed as an override into the texture builder. A ZoneBuildPending guard prevents concurrent threads destroying each other's textures.

Hot-loop performance

The spray aim loop ran 6 raycasts at Wait(0) — 60+ fps.

Fix (v2.0.1): throttled to Wait(16), plus cache.ped replacing PlayerPedId() in all hot paths. ~10× lower CPU at idle.

09 / More

FAQ

Is rde_organizations required?

No — fully optional. Without it, rde_crew runs standalone with its own boss NPC and /crew menu.

How many graffiti pieces can render at once nearby?

The render pool has 10 slots by default — extend GRAFFITI_PROP_POOL in client/modules/spray.lua for denser territory clusters.

10 / More

Changelog

v2.0.1

OrgBridge integration, 7 authentic cap types, full orthonormal wall alignment, ~10× lower idle CPU.

v2.0.0

Two-screen NUI flow (draw → place), O(1) canvas drawing, rotation column added via auto-migration.