Spawnmanager
The spawnmanager is a base resource that handles the spawning of the player. It allows you to choose when and where to spawn the player and also control how they respawn.
Spawnmanager is included and maintained at the cfx-server-data repository.
Map resources for mapmanager will have their spawnpoints loaded and usable in spawnmanager, as long as they are started after spawnmanager.
For signatures, return values, ID-versus-index differences and a minimal resource, read the spawnmanager export contracts. These client exports must not compete with a framework’s existing spawn controller.
Exports
Client
spawnPlayer- Starts spawning with a supplied definition or configured spawn point; completion uses a callback.addSpawnPoint- Adds a custom spawn point and returns its registration ID.removeSpawnPoint- Removes a spawn point by registration ID.loadSpawns- Adds spawn points from a JSON string containing aspawnsarray; it does not read a file path.setAutoSpawn- Enables or disables automatic spawning.setAutoSpawnCallback- Sets the automatic-spawn callback and enables autospawn.forceRespawn- Requests a respawn through the enabled automatic-spawn monitor.
Events
Client
- playerSpawned - Fires locally when spawning completes, before the optional completion callback.