# engineSetElementStencil (Client)

> Marks a vehicle, ped or object with a stencil value, which post shaders read for outlines, highlights and similar effects.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Materials and shaders
- **URL**: https://wiki.mymp.gg/en/engineSetElementStencil

## Syntax

```lua
bool engineSetElementStencil(element element, int value [, bool seeThrough = false, int priority = 0])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `element` | `element` | A vehicle, ped, player or object. |
| `value` | `int` | The mark, an integer from 1 to 255. |
| `seeThrough` | `bool` | An extra flag post shaders read with `stencil_see_through`. *(default: `false`)* |
| `priority` | `int` | When several resources mark the same target, the highest priority wins; between equals, the newest. *(default: `0`)* |

## Returns

`true` when the mark was applied.

## Example

```lua
local outline = engineCreateMaterial(engineCreateShader("shaders/outline.shader"))
engineAddPostProcess(outline)

local vehicle = createVehicle("infernus", 2495.0, -1680.0, 13.4)
engineSetElementStencil(vehicle, 1)
```

### Note

The value takes 1 to 255, but post shaders read only its low 7 bits (`stencil` gives 0 to 127): from 128 on the top bit is lost, and 128 reads as unmarked. An element that is not a vehicle, ped, player or object is an error.

## See also

- [engineGetElementStencil (Client)](https://wiki.mymp.gg/en/engineGetElementStencil.md): Gives the stencil value a vehicle, ped or object is marked with.
- [engineRestoreElementStencil (Client)](https://wiki.mymp.gg/en/engineRestoreElementStencil.md): Removes the stencil mark this resource set with engineSetElementStencil.
- [engineSetModelStencil (Client)](https://wiki.mymp.gg/en/engineSetModelStencil.md): Marks every instance of a model with a stencil value, which post shaders read for outlines, highlights and similar effects.
- [engineAddPostProcess (Client)](https://wiki.mymp.gg/en/engineAddPostProcess.md): Turns on a post process on the screen: a material whose shader is #type post.
