# CS\_PANICBUTTON

* [Get the script](https://core-services.tebex.io/category/products)
* [Watch the preview](https://www.youtube.com/@core-services/videos)

***

## Installation

* [ ] Drag and drop into your resources folder
* [ ] Add to your `server.cfg`:

```
start CS_DEATHTIMEOUT
```

* [ ] Import the panicbutton sql into your database
* [ ] Configure it to your liking.

***

## Configuration

### Config.lua

This configuration file sets up how the panic button works for your server.

<details>

<summary>General Settings</summary>

* **UseCustomNotification**: `true / false` – Use a custom notification function.
* **CustomNotification(receiver, msg)**: Function to display notifications.

</details>

<details>

<summary>Menu &#x26; Button Options</summary>

* **EnableMenu**: `true / false` – Display NativeUI menu.
* **LocalPaniceEnabled**: `true / false` – Enable local panic if menu is disabled.
* **GlobalPaniceEnabled**: `true / false` – Enable global panic if menu is disabled

</details>

<details>

<summary>Job &#x26; Permissions</summary>

* **AllowedJobs**: Jobs allowed to trigger the panic button. Example: `{"ambulance", "police", "fib", "doj"}`
* **GlobalPanic**: Jobs that get notified of global panic. Example: `{"police", "ambulance", "fib", "doj"}`

</details>

<details>

<summary>Item Requirements</summary>

* **NeedItem**: `true / false` – Whether a panic button item is required.
* **ItemName**: Name of the required item. Example: `"panicbutton"`
* **AllowedWhenDead**: `true / false` – Allow panic button usage when dead.

</details>

<details>

<summary>Key Bindings</summary>

* **DefaultPanicbuttonKey**: Key for menu (`"M"`)
* **DefaultLocalPanicbuttonKey**: Key for local panic (`"U"`)
* **DefaultGlobalPanicbuttonKey**: Key for global panic (`"I"`)

</details>

<details>

<summary>Sound &#x26; Waypoints</summary>

* **SoundEnabled**: `true / false` – Play alarm sound
* **SetWaypoint**: `true / false` – Automatically set waypoint for all available units

</details>

***

### Notifications & Locales

<details>

<summary>UI</summary>

* `UIHeading`: `"Panic Button"`
* `UISecondHeading`: `"Wähle die Art des Panic Buttons"`
* `UILocalButton`: `"Lokaler Panic Button"`
* `UILocalDescription`: `"Drücke den Panic Button, um deine Fraktion zu alarmieren"`
* `UIGlobalButton`: `"Globaler Panic Button"`
* `UIGlobalDescription`: `"Drücke den Panic Button, um alle EMS Fraktion zu alarmieren"`

</details>

<details>

<summary>Errors &#x26; Messages</summary>

* `CooldownActive`: `"Der Cooldown ist aktiv"`
* `NotHasAllowedJob`: `"Du hast nicht den richtigen Job, um den Panic Button zu benutzen!"`
* `NeedItem`: `"Du brauchst einen Panic Button, um dies zu tun!"`
* `BlipName`: `"Panicbutton"`

</details>

<details>

<summary>Notifications</summary>

* **Local Notification**:
  * `LocalNotificationTitle`: `"Lokaler Panic Button"`
  * `LocalNotificationMessage`: `"%s %s hat einen lokalen Panic Button ausgelöst!"`
* **Global Notification**:
  * `GlobalNotificationTitle`: `"Globaler Panic Button"`
  * `GlobalNotificationMessage`: `"%s %s hat einen globalen Panic Button ausgelöst!"`

</details>

<details>

<summary>Webhooks</summary>

* `WebhookLocalButtonPressed`: `"**%s** (%s) hat einen **lokalen Panic Button** ausgelöst.\nJob: **%s**\nRang: **%s**\nDiscord: **<@%s>**"`
* `WebhookGlobalButtonPressed`: `"**%s** (%s) hat einen **globalen Panic Button** ausgelöst.\nJob: **%s**\nRang: **%s**\nDiscord: **<@%s>**"`

</details>

***

### Webhook Configuration

<details>

<summary>webhook.lua</summary>

```
Config.webhookLink = "https://discord.com/api/webhooks/1105529980663910410/ixsNsU6glxkmJYWmeTKrNlQIyjD-hSGbkEjImQaOOVAsvd8qJYoouUHaJP99V6zy5uGT"
```

* Logs all local and global panic button triggers to Discord.

{% hint style="info" %}
**Tip:** Leave the URL as an empty string `""` if you do not want the webhook to trigger for that event.
{% endhint %}

</details>

<details>

<summary>Features</summary>

* Local and global panic button alerts
* Custom notifications or UI integration
* Optional item requirement for panic button
* Keybinding configurable for menu, local, and global triggers
* Sound alerts and automatic waypoint setting
* Discord webhook logging for all button presses
* English and German locale support

</details>

***

## Support

If you have any further questions, open a ticket on our discord server: [**discord.gg/core-services**](https://discord.gg/core-services)
