# Exports and events

## Server exports

### deploy

Lays a stick without a player throwing it. c3r's pursuit backup uses this.

```lua
local id = exports.lwk_stopstick:deploy(officer, at, angle, from)
```

| Parameter | Type | What it is |
|---|---|---|
| `officer` | `number` | Server id told about hits |
| `at` | `vector3` | Where on the road |
| `angle` | `number` | The stick's line, in degrees (`math.deg(math.atan(y, x))` of its direction) |
| `from` | `vector3?` | Optional: where it's thrown from, for the throw animation |

Returns the stick's id.

### remove

Pulls a stick off the road.

```lua
exports.lwk_stopstick:remove(id)
```

### useItem

The inventory item's use handler. Point your inventory item at it (see [Overview](/docs/lwk_stopstick/overview#where-sticks-come-from)); you won't call it yourself.

## Server events

### lwk_stopstick:vehicleHit

Fires once per car pass over a stick.

```lua
AddEventHandler('lwk_stopstick:vehicleHit', function(d)
    print(('%s burst %d tyres on the %s'):format(GetPlayerName(d.officer), #d.tyres, d.label))
end)
```

| Field | Type | What it is |
|---|---|---|
| `d.stick` | `number` | The stick's id |
| `d.officer` | `number` | Server id of whoever deployed it |
| `d.vehicle` | `number \| nil` | The car's network id |
| `d.label` | `string` | The car's name |
| `d.tyres` | `number[]` | Tyre indexes that burst |
| `d.coords` | `vector3` | Where |
