# CFX::SET_PLAYER_CONTROL

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

## Signature

```c
void SET_PLAYER_CONTROL(Player player, BOOL bHasControl, int flags);
```

## Parameters

- `player` (`Player`)
- `bHasControl` (`BOOL`)
- `flags` (`int`)

## Returns

`void`

## Description

*Source: Cfx.re native reference*

```
Flags:
SPC_AMBIENT_SCRIPT = (1 << 1),
SPC_CLEAR_TASKS = (1 << 2),
SPC_REMOVE_FIRES = (1 << 3),
SPC_REMOVE_EXPLOSIONS = (1 << 4),
SPC_REMOVE_PROJECTILES = (1 << 5),
SPC_DEACTIVATE_GADGETS = (1 << 6),
SPC_REENABLE_CONTROL_ON_DEATH = (1 << 7),
SPC_LEAVE_CAMERA_CONTROL_ON = (1 << 8),
SPC_ALLOW_PLAYER_DAMAGE = (1 << 9),
SPC_DONT_STOP_OTHER_CARS_AROUND_PLAYER = (1 << 10),
SPC_PREVENT_EVERYBODY_BACKOFF = (1 << 11),
SPC_ALLOW_PAD_SHAKE = (1 << 12)
See: https://alloc8or.re/gta5/doc/enums/eSetPlayerControlFlag.txt
```

**This is the server-side RPC native equivalent of the client native [SET_PLAYER_CONTROL](?\_0x8D32347D6D4C40A2).**

## Usage

### Lua

```lua
SetPlayerControl(player, bHasControl, flags)

-- always available, by hash
Citizen.InvokeNative(0xd17afcd8, player, bHasControl, flags)
```

### JavaScript

```js
SetPlayerControl(player, bHasControl, flags);

// by hash
Citizen.invokeNative('0xd17afcd8', player, bHasControl, flags);
```

### C#

```csharp
Function.Call((Hash)0xd17afcd8, player, bHasControl, flags);
```

*Sources: Cfx.re native reference.*
