Read the Cookbook as a dated archive
The official Cookbook archive contains 20 articles from 2019–2022. These notes explain each article’s useful technical content without presenting its release announcements, benchmark results or unfinished plans as current guarantees. The publication date belongs to the article; this page’s review date does not make the historical instructions current.
2019-06-09: Emoji in Scaleform GFx
The article describes work on GTA’s GFx version 3 renderer, including both Flash text fields and immediate-mode text drawing. The implementation converted SVG artwork to stripped SWF sprites and extended inline image handling, then corrected aspect ratios, spacing and multi-code-point emoji combinations. This was renderer work, not a resource-level native for turning any SVG into an emoji.
The article’s planned release state, HTML escaping fixes and complex-script limitations must be read as historical. Do not infer present Arabic shaping or all-font support from an emoji screenshot. For a resource, test the actual text, font, build and rendering path, distinguish NUI from Scaleform, and escape untrusted input. Continue with Scaleform.
Source: emoji renderer article .
2019-06-23: Compile-time Jenkins hashes
CfxLua backtick literals turn a fixed name such as `a_m_y_skater_01` into a Jenkins hash during compilation. This avoids either an unreadable hardcoded number or a repeated GetHashKey call for an unchanging name. Use runtime hashing when the name is genuinely dynamic; do not confuse a model hash with a native-function identifier.
Backticks are a CfxLua extension, not stock Lua string syntax. The article’s 10,000-iteration timings describe one historical test system and are not a modern performance target. Remove unnecessary per-frame work before using microbenchmarks to justify a change. See Lua functions.
Source: compile-time hashes .
2019-06-29: Adaptive Cards during admission
The admission workflow defers a connection, yields, presents a JSON-encodable card and receives submitted data in the card callback. A callback can present a subsequent card before completing the deferral. Submitted fields, including action identifiers, are untrusted input.
The archived demonstration deliberately returns the entered password in a rejection message. Do not reproduce that behavior in a real allowlist or password flow. Validate on the server, redact diagnostics, bound the admission deadline, complete once, and follow the current tick requirements between deferral operations. Remote images can also disclose requests to another operator. Use connection deferrals rather than copying the historical demonstration wholesale.
Source: Adaptive Cards .
2019-06-29: Enumerate active players
On the client, iterate GetActivePlayers() rather than probing every integer from zero to 255 with NetworkIsPlayerActive. Its values are client player indices, suitable for client functions such as GetPlayerPed; they are not the server session IDs returned by the server’s GetPlayers().
The active list reflects what the client knows. It is not an authoritative complete server roster under scoped networking. Resolve the right ID type, handle a player leaving scope during the operation, and keep server-wide decisions on the server. See network IDs.
Source: active-player iteration .
2019-07-15: Cross-runtime stack traces
This change stitched user frames across Lua, JavaScript and Mono/C# calls, reduced repeated reference-call errors and formatted C# method names more clearly. It explains why a useful stack can contain files from more than one resource and language.
The proposed future stack API and JavaScript source-map support are not evidence that a particular installed build implements them. Preserve the first complete error, resource names, relevant source lines and exact artifact versions when reproducing a failure. Do not remove a frame simply because it comes from another runtime. Use debugging and profiler captures.
Source: stack-trace changes .
2019-08-12: Experimental OneSync switches
The article introduced onesync_distanceCullVehicles and onesync_forceMigration for historical culling and ownership problems. Its later note explicitly says both became enabled by default in early 2020. The original “disabled by default” discussion therefore is not a current configuration recipe.
Occupied vehicles can leave a client’s scope, and an unresponsive owner can require migration. Test those behaviors directly instead of applying old “ghost vehicle” presets. Changing random synchronization variables can conceal an unrelated asset or resource problem. Use OneSync and server configuration.
Source: archived experimental switches .
2019-08-12: Minimap screen coordinates
The original technique sets left/bottom script graphics alignment, transforms the minimap’s normalized frontend coordinates with GetScriptGfxPosition, resets graphics alignment and multiplies by the active screen dimensions. Its constants come from the stock frontend.xml minimap definition: position -0.0045, 0.002 and height 0.188888.
The top-left sample therefore evaluates the vertical coordinate 0.002 - 0.188888 before converting to pixels. Restore graphics alignment after the calculation so other drawing code is unaffected. A replacement minimap, safe-zone setting or changed frontend layout can invalidate those constants. Test multiple aspect ratios and distinguish normalized game coordinates from browser CSS pixels before aligning an NUI overlay.
Source: minimap coordinate calculation .
2019-08-19: Intercepting explosion events
The original OneSync example handled the server event explosionEvent(sender, eventData) and used positional fields to decide whether to cancel routing. It was an early event-parser announcement, not an exhaustive current event catalog.
Validate named fields and ranges before applying an operation-specific rule. Cancellation can prevent the documented routing action; it does not automatically undo everything already simulated on the originating client or stop unrelated handlers. Do not ban a player solely because an unverified payload looks unusual. Current contracts and their limits are in server events and game-event payload diagnosis.
Source: explosion interception .
2019-10-29: Resource-download caching proxy
fileserver_add associates a resource-name pattern with a download endpoint; fileserver_remove and fileserver_list manage those associations. The original example warns against a trailing slash in its file-server URL and uses adhesive_cdnKey as part of the download setup.
Its year-long cache configuration and lack-of-invalidation warning describe the old implementation. A production design must verify the current URL/hash behavior, query-string cache keys, authentication-related settings, TLS and purge procedure. Test an actual resource update and rollback with both cold and warm caches. Do not assume HTTP asset caching also proxies the game’s UDP traffic. Use networking and proxies.
Source: download proxy article .
2020-01-06: Console and resource key bindings
Paired +command and -command handlers support press/release behavior, while RegisterKeyMapping exposes a user-editable binding. The console has separate bind, rbind, unbind, seta, toggle and +vstr workflows. A saved preference can override the default in a resource’s source code.
The article’s early limitation to one binding is historical. Its extreme audio-volume demonstration is not a safe test to copy. Back up existing bindings, use harmless commands, and restore the previous key rather than deleting all user settings. The article identifies fxd:/fivem.cfg under the CitizenFX application-data directory for the readable configuration. See key mapping and client console commands.
Source: console bindings .
2020-01-20: Gallery uploads
The historical process requires a resource that saves a gallery photograph, a linked Cfx.re account, selecting a photo in the pause-menu Gallery and explicitly confirming upload. The old “Upload to Social Club” label led to the Cfx.re forum’s Snapmatic area in that workflow; the label alone does not identify today’s destination.
This is a publication action, not a diagnostic prerequisite. Review the image for private chat, names and location clues, confirm the destination and do not automate upload without the user’s approval. The archive does not prove the endpoint or UI still works on a current client.
Source: gallery upload workflow .
2020-02-24: CitizenFX C# templates
The announcement introduced the CitizenFX.Templates NuGet package and the cfx-resource template, with further instructions in the generated README. Its installation syntax, dotnet new -i, belongs to the SDK versions of that period.
Check the template package, supported SDK and generated target framework before installing or updating anything. A current .NET SDK does not make every old Mono client assembly compatible, and an Enhanced target has separate requirements. Use the C# resource guide and compiled interoperability lab for the relevant project structure.
Source: template announcement .
2020-07-10: Server-side entity persistence
This article explains how script-owned entities can enter an unowned state when no player has them in scope, preserve script ownership across migration, and return to client simulation later. Faraway entities need not remain controlled by their original client. Non-script entities can instead be reassigned or removed.
“Persistence” here describes lifetime within a running synchronized world. It is not a database guarantee or automatic restoration after a server restart. Separate desired persistent records, server entity existence and current simulation ownership. Verify no-nearby-player and owner-disconnect cases in platform migration.
Source: entity persistence note .
2020-08-25: C# template fixes
Version 0.2.2 of the historical template/SDK/framework packages addressed errors where built-in language types were not accepted by the compiler. The announcement explains a specific packaging failure, not a recommendation to pin new projects to that old version.
When a similar error occurs, record the exact SDK, target framework, package lock state and CitizenFX assemblies, then reproduce in a minimal project. Do not mix client and server assemblies or upgrade unrelated packages until the failing boundary is understood. See C# tasks and build setup.
Source: template fix announcement .
2020-11-28: Routing buckets
The file path contains November 27, but the article’s publication field is November 28. It introduced separate player/entity routing buckets, each with its own population world grid. The relevant native families get or set a player’s or entity’s routing bucket; their IDs are not interchangeable.
Buckets suit separate sessions, game modes and character-selection scenes. The article explicitly excludes interiors that need to see the surrounding outside world. It also contains historical warnings about explosions/projectiles and future bucket-targeted events; neither a permanent bug claim nor an assumed fix should be inferred from that announcement. Test the current artifact’s behavior and restore a player’s bucket when the session ends. See OneSync.
Source: routing buckets .
2021-04-09: Raw XML YMAP and YTYP
The note describes the game parsing XML-formatted map/archetype data when the file is named with its normal .ymap or .ytyp extension, without an additional .xml suffix. Renaming is not a general conversion rule for every asset format.
The game parser can differ from CodeWalker or OpenIV. Validate the actual structure and chosen game track; a desktop editor accepting a file does not prove in-game loading or Gen8/Gen9 compatibility. Keep the source version and a known-good rollback. See asset authoring and streaming.
Source: raw map/archetype files .
2021-04-13: Modified scenario manifests
The scenario example replaces sp_manifest.ymt through SCENARIO_POINTS_OVERRIDE_FILE, with referenced region files supplied by the resource. It uses a compcache:/resource/region path for the described resource-registration behavior.
Match the manifest to the game build. The archived warning gives ERR_STR_PACK_2 when newer island scenarios are referenced on an older build. Its correction also says that XML containing hash_ fields can behave incorrectly and recommends CodeWalker’s PSO save output for that case. Do not generalize the separate raw-YMAP/XML note to scenario YMTs. Test with a disposable resource and retain the original manifest; do not redistribute game archives as a tutorial attachment.
Source: scenario file overrides .
2021-07-17: Runtime ACL configuration
The article maps application roles to ACE objects and principals using add_ace, add_principal and remove_principal. A resource can receive narrowly scoped permission to execute the required management commands. Other resources can then check the resulting permission without depending on the application’s internal job API.
The runtime ACL state is not its own durable persistence layer. Reconstruct intended roles after restart and revoke session principals on disconnect. Allowlist role names before inserting them into console commands. The archived JavaScript const source = source line has a lexical-initialization error; capture global.source under a different local name instead. See permissions and JavaScript events.
Source: built-in ACL note .
2021-12-21: Delayed console bindings
A console binding can contain semicolon-separated commands and wait 1500 to delay the following command by approximately 1.5 seconds. This is the console’s command-buffer operation, not Lua’s coroutine Wait function.
A binding that invokes an emote or chat command depends on the corresponding resource. Test harmless output first, avoid overwriting an existing user binding without recording it, and remove or restore the test binding afterward. The article does not define cancellation of a command sequence already in progress. See client console reference.
Source: delayed bindings .
2022-01-06: The Player_Vehicle decorator
The example registers the exact decorator name Player_Vehicle with integer type 3, checks its registered type and sets the value -1 on a vehicle. The reported effects concern game behavior such as radio emitters and vehicle entry.
Register consistently once, verify that the vehicle exists and that the operation is valid in its ownership context, and preserve the exact spelling used by the implementation. This decorator is not a database ownership record, an anti-theft permission or proof that the player bought the vehicle. Test the desired game behavior independently of server-authoritative ownership logic.
Source: player-vehicle decorator .
Use the archive without reviving obsolete assumptions
Each article above has a local explanation and an immutable source link. Historical review is not a claim that every old endpoint, package, UI label or release limitation remains current. Prefer the linked task guide for present work, keep version-specific evidence, and treat in-game acceptance as a separate check from documentation inventory coverage.