# FiveM Cookbook Archive: Contracts and Migration Notes

> Review all 20 archived Cfx.re Cookbook articles with publication dates, practical contracts, corrected pitfalls and links to current FiveM guides.

Source: https://fivemdocs.com/reference/cookbook

The [official Cookbook archive](https://github.com/citizenfx/fivem-docs/tree/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook) 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](/scripting/scaleform).

Source: [emoji renderer article](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2019/06/09/our-work-on-supporting-emoji-in-scaleform-gfx.md).

## 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](/reference/lua-functions).

Source: [compile-time hashes](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2019/06/23/lua-support-for-compile-time-jenkins-hashes.md).

## 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](/scripting/player-connecting) rather than copying the historical demonstration wholesale.

Source: [Adaptive Cards](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2019/06/29/adaptive-cards-in-deferrals.md).

## 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](/scripting/networking/ids).

Source: [active-player iteration](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2019/06/29/get_active_players-the-replacement-for-player-loops.md).

## 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](/scripting/debugging/using-profiler).

Source: [stack-trace changes](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2019/07/15/improving-script-stack-traces.md).

## 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](/ops/onesync) and [server configuration](/reference/server-configuration).

Source: [archived experimental switches](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2019/08/12/two-new-experimental-onesync-variables.md).

## 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](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2019/08/12/useful-snippet-getting-the-top-left-of-the-minimap-in-screen-coordinates.md).

## 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](/reference/server-events) and [game-event payload diagnosis](/reference/game-event-payloads).

Source: [explosion interception](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2019/08/19/onesync-intercepting-game-events-such-as-explosions.md).

## 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](/ops/networking).

Source: [download proxy article](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2019/10/29/optimizing-resource-downloads-using-a-caching-proxy.md).

## 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](/scripting/key-mapping) and [client console commands](/reference/client-console).

Source: [console bindings](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2020/01/06/using-the-new-console-key-bindings.md).

## 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](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2020/01/20/uploading-photos-from-in-game-to-the-cfx-re-gallery.md).

## 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](/scripting/introduction/creating-your-first-script-csharp) and [compiled interoperability lab](/scripting/csharp-async-interop) for the relevant project structure.

Source: [template announcement](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2020/02/24/try-the-new-citizenfx-c-templates-for-fivem.md).

## 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](/scripting/platform-migration).

Source: [entity persistence note](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2020/07/10/a-quick-note-about-onesync-server-side-persistence.md).

## 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](/scripting/csharp-async-interop).

Source: [template fix announcement](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2020/08/25/citizenfx-c-templates-are-fixed.md).

## 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](/ops/onesync).

Source: [routing buckets](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2020/11/27/routing-buckets-split-game-state.md).

## 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](/scripting/asset-authoring) and [streaming](/scripting/assets-streaming).

Source: [raw map/archetype files](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2021/04/09/fyi-fivem-and-redm-support-raw-ymap-ytyp-files.md).

## 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](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2021/04/13/using-modified-scenario-files-on-fivem.md).

## 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](/security/permissions) and [JavaScript events](/reference/javascript-events).

Source: [built-in ACL note](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2021/07/17/quick-note-on-using-built-in-acl-security.md).

## 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](/reference/client-console).

Source: [delayed bindings](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2021/12/21/making-a-console-key-bind-wait-between-commands.md).

## 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](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/cookbook/2022/01/06/marking-a-vehicle-as-player-vehicle-for-game-code.md).

## 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.
