# FiveM Stock Resources: Dependencies and Mapmanager APIs

> Choose one owner for stock spawning and chat, configure mapmanager dependencies, understand map compatibility and inspect all seven mapmanager exports.

Source: https://fivemdocs.com/reference/stock-resource-setup

Stock resources provide useful defaults, but a framework may replace them. A familiar event name does not guarantee that the provider is running or that a replacement implements the same contract. The [official stock-resource directory](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/resources/_index.md) distinguishes platform resources from community resources and the marketplace.

## Assign responsibility once

| Provider | Responsibility and dependency boundary |
| --- | --- |
| `spawnmanager` | Client spawn points, explicit spawning and automatic respawn. Do not enable its autospawn alongside a framework's competing character/spawn owner. |
| `mapmanager` | Gametype/map selection and compatibility, with lifecycle events and map directives. It does not compile an MLO or replace asset authoring. |
| `chat` | Stock chat events, suggestions, templates and server hooks/modes. A custom chat can change that surface. |
| `baseevents` | Reports events from its own client monitoring. Several vehicle reports arrive on the server and remain untrusted client reports. |
| `sessionmanager` | Legacy session lifecycle integration. Its events are not universal account-authentication hooks. |
| Loading screen resource | Browser loading UI and its shutdown lifecycle, not an admission/allowlist authority. |
| txAdmin | Administration and monitoring outside the role of an ordinary client gametype resource. |

Declare actual dependencies in `fxmanifest.lua`. Start providers before their consumers and observe both client and server startup errors. Do not install two resources simply because both advertise the same feature. Use [stock event contracts](/reference/stock-resource-events), [spawnmanager exports](/reference/spawnmanager), [loading messages](/reference/loading-screen-events) and [chat exports](/reference/chat-exports) for the separate APIs.

## Mapmanager exports are server-side

The [official mapmanager page](https://github.com/citizenfx/fivem-docs/blob/c2b2125759dfb8d0040492692aa1ac81319efa62/content/docs/resources/mapmanager/_index.md) lists these seven exports. The correct resource spelling is **`mapmanager`**; the source's `mapmanger` example is a typo. Use `exports['mapmanager']:getCurrentMap()` from a server script, after that provider has started.

| Export | Documented input and effect |
| --- | --- |
| `getCurrentGameType()` | Return the currently selected gametype. Do not assume a nonempty selection before initialization. |
| `getCurrentMap()` | Return the currently selected map. |
| `changeGameType(gameType)` | Change gametype; the documented implementation stops an incompatible current map, stops the old gametype and starts the requested resource. |
| `changeMap(map)` | Stop the current map if present, then start the requested map resource. |
| `doesMapSupportGameType(gameType, map)` | Check registered gametype/map compatibility. Unknown entries fail; a map with no declared gametype restrictions is compatible in the documented implementation. Treat a false/nil result as not allowed. |
| `getMaps()` | Return the provider's registered map table. Its internal records are not an invitation for another resource to mutate provider state. |
| `roundEnded()` | Schedule the provider's round-end handling. The source implementation uses a 50 ms timeout; this is not a promise that an arbitrary game round immediately ends. |

Selection-changing exports can stop and start resources. Never expose them through an unrestricted client network event. Validate the requested name against a server-owned set and require a deliberately scoped administrative permission. Check the resulting provider state and startup logs instead of assuming that an export call proves the requested resource started successfully.

## Gametype and map metadata

A gametype is a resource that declares the appropriate `resource_type` metadata for mapmanager. A map declares its map role and any supported gametypes. Preserve the actual provider's metadata format rather than inventing a new `gameType` manifest field or confusing `game 'gta5'` with a gametype selection.

The `getMapDirectives` event lets a provider register map directives with paired creation and deletion callbacks. Spawnmanager uses this mechanism to load declared spawn points and remove them when the map is torn down. Its independent `loadSpawns` export instead accepts a JSON string containing a `spawns` array; those are different input paths. See [map-directive registration](/resources/mapmanager/events/getMapDirectives).

Client gametype/map start events are the appropriate points for consumer initialization. Stop events can run after the corresponding resource is gone, so avoid calling an export on the stopped provider. Always filter events to the resource or map your feature owns and clean up registered callbacks/state. See [resource lifecycle](/scripting/resource-lifecycle).

## Empty indexes and the resource template

The official resource-template page is explicitly a **draft** with placeholder headings for client/server exports and events. Several stock-resource `functions` or `events` index files contain no contracts beyond navigation. This guide supplies navigation to the documented providers; it does not manufacture exports from those empty headings.

For a new independent resource reference, document the provider/version, execution side, arguments, return values, prerequisites, teardown and one observable example. A method copied from another framework is not a stock API merely because its name looks plausible.

## Acceptance checklist

Test a missing dependency, a stopped provider, an unsupported gametype/map pair, a normal map change, a provider restart and a consumer stopping independently. Confirm that a single system owns spawning, chat and world state after each transition. Host-side documentation tests can inventory exports and routes, but actual resource lifecycle dispatch must be exercised in the intended FXServer/client environment.
