# MISC::_COUNT_BIT_FLAGS

- **Hash:** `0xE704838F36F93B7B`
- **Namespace:** MISC
- **Runtime name (Lua/JS):** `CountBitFlags`
- **Side:** client (game native)
- **Name status:** community guess (may change)
- **Documentation:** named only
- **Since game build:** 1355
- **URL:** https://natives.borderlinerp.com/natives/MISC/_COUNT_BIT_FLAGS

## Signature

```c
int _COUNT_BIT_FLAGS(Any* bitFlags);
```

## Parameters

- `bitFlags` (`Any*`)

## Returns

`int`

## Usage

### Lua

```lua
local retval, bitFlags = CountBitFlags(bitFlags)

-- always available, by hash
local retval, bitFlags = Citizen.InvokeNative(0xE704838F36F93B7B, Citizen.PointerValueIntInitialized(bitFlags), Citizen.ResultAsInteger())
```

### JavaScript

```js
const [retval, bitFlags] = CountBitFlags(bitFlags);

// by hash
const [retval, bitFlags] = Citizen.invokeNative('0xE704838F36F93B7B', Citizen.pointerValueIntInitialized(bitFlags), Citizen.returnResultAnyway(), Citizen.resultAsInteger());
```

### C#

```csharp
var bitFlags = new OutputArgument();
int retval = Function.Call<int>((Hash)0xE704838F36F93B7B, bitFlags);
// bitFlags.GetResult<int>()
```

- The last argument is an in/out pointer: pass its initial value, and the updated value is returned after the result.
- `Any*` arguments are often structs. Build them with a DataView buffer and pass it with `:Buffer()` — see the examples and notes below.
- The name is a community guess and may change. If the named call is missing in your client build, use `InvokeNative` with the hash — it always works.

*Sources: alloc8or RDR3 NativeDB.*
