# Events

## lwk_taser:used

A server event that fires on every use, for MDTs, logs or your own systems. The Discord audit log is built from the same data.

```lua
AddEventHandler('lwk_taser:used', function(d)
    print(('%s: %s on %s (%s)'):format(d.name, d.action, d.target, d.outcome))
end)
```

| Field | Type | What it is |
|---|---|---|
| `d.action` | `string` | What happened, e.g. `'Probe deployed (bay 3)'`, `'Warning arc'`, `'Magazine loaded'`, `'Barbs removed'`, `'Barbs ripped out (distance)'` |
| `d.officer` | `number` | Server id of whoever used it |
| `d.name` | `string` | Their player name |
| `d.device` | `string` | Which taser, or `'?'` |
| `d.cartridge` | `string` | The magazine involved, or `'n/a'` |
| `d.target` | `string` | `'Name [id]'` for a player, `'NPC'`, or `'n/a'` |
| `d.outcome` | `string` | `'hit'`, `'miss'`, `'lockout'`, or `'-'` |
| `d.coords` | `vector3` | Where the officer was |

## Audit log

Set a Discord webhook in `server.cfg` (not the shared config, so players can't read it) and every use is posted:

```cfg
set lwk_taser_webhook "https://discord.com/api/webhooks/..."
```
