# CFX::REGISTER_RESOURCE_BUILD_TASK_FACTORY

- **Hash:** `0x285B43CA`
- **Namespace:** CFX
- **Runtime name (Lua/JS):** `RegisterResourceBuildTaskFactory`
- **Side:** server (Cfx runtime native)
- **Name status:** official
- **Documentation:** described
- **URL:** https://natives.borderlinerp.com/natives/CFX/REGISTER_RESOURCE_BUILD_TASK_FACTORY

## Signature

```c
void REGISTER_RESOURCE_BUILD_TASK_FACTORY(char* factoryId, func factoryFn);
```

## Parameters

- `factoryId` (`char*`) — The identifier for the build task.
- `factoryFn` (`func`) — The factory function.

## Returns

`void`

## Description

*Source: Cfx.re native reference*

Registers a build task factory for resources.
The function should return an object (msgpack map) with the following fields:

```
{
// returns whether the specific resource should be built
shouldBuild = func(resourceName: string): bool,

// asynchronously start building the specific resource.
// call cb when completed
build = func(resourceName: string, cb: func(success: bool, status: string): void): void
}
```

## Usage

### Lua

```lua
RegisterResourceBuildTaskFactory(factoryId, factoryFn)

-- always available, by hash
Citizen.InvokeNative(0x285b43ca, factoryId, factoryFn)
```

### JavaScript

```js
RegisterResourceBuildTaskFactory(factoryId, factoryFn);

// by hash
Citizen.invokeNative('0x285b43ca', factoryId, factoryFn);
```

### C#

```csharp
Function.Call((Hash)0x285b43ca, factoryId, factoryFn);
```

*Sources: Cfx.re native reference.*
