Core-Services
DiscordShop
  • 🏠HOME
  • ⚙️SCRIPTS
    • CS_MENU_DEFAULT
    • CS_VISA
    • CS_SHOPS
    • CS_GARAGE
    • CS_REVIVESTATION
    • CS_PANICBUTTON V2
    • CS_DEATHTIMEOUT V2
    • CS_VEHICLERENTAL
      • Installation
      • Configuration
        • config.lua
        • devConfig.lua
        • framework.lua
        • webhook.lua
      • Exports
Powered by GitBook
On this page
  • Installation
  • Configuration
  • Config.lua
  • Functions
  • Webhook.lua
  • Example Usage
  • Support

Was this helpful?

  1. SCRIPTS

CS_PANICBUTTON V2

A panicbutton script combining both user friendliness and realism for your server.

PreviousCS_REVIVESTATIONNextCS_DEATHTIMEOUT V2

Last updated 6 months ago

Was this helpful?


Installation


Configuration

Config.lua

1. General Settings

  • Locale: Sets the language for the Panic Button messages. Options are:

    • "EN" for English

    • "DE" for German

  • Framework: Specifies the framework your server uses. Options are:

    • "ESX"

    • "QBCore"

    • "Custom"

The framework feature currently is only experimental. The only supported framework is ESX!

2. Commands

Each command defines a specific Panic Button functionality. Two commands are predefined:

localPanic

  • Sends a localized panic alert to nearby players.

  • Configuration options:

    • enabled: Enables or disables this command.

    • commandName: The name of the command (default is "localPanic").

    • defaultKey: The default keyboard key to trigger this command (default is "U").

    • showUI: If true, displays a user interface when the button is pressed.

    • autoClose: If true, closes the UI automatically after activation.

    • allowedWhenDead: If true, allows the command even when the player is dead.

    • setWaypoint: If true, automatically sets a waypoint for responding units.

    • radius: Defines the area of effect for the alert in meters. Set to false for global.

    • timeUntilRemoval: Time in seconds before the alert is removed.

    • soundEnabled: Enables or disables the panic alert sound.

    • playSoundForNearbyPlayers: If true, plays a sound for nearby players.

    • playClickRadius: The radius in which the sound is audible.

    • needItem: If true, requires the player to have a specific item to trigger the command.

    • itemName: The required item's name (e.g., "panicbutton").

    • jobs: Specifies which jobs can use this command and their minimum required grades (e.g., ["police"] = 5).


Functions

  • PanicButtonNotification: Defines how notifications appear for different panic types.

    • localPanic: Shows a localized alert.

    • globalPanic: Shows a global alert.

  • ShowUI(): Client function triggered when the UI is displayed.

  • HideUI(): Client function triggered when the UI is hidden.

  • NotificationFunction(title, msg, type): The notification function used.

Make sure to change the Notification function to your notify trigger!

Or else the script will not work properly.

Notification Types

Different types of notifications available:

  • NotifyTypes: Defines types like info, error, success, warning.

Locales

Translations for different languages:

  • LocalesPanicbutton: Contains translations for English (EN) and German (DE).

ESX Version Handling

Determines whether an old or new version of ESX is being used and initializes the shared object accordingly. If you want to, you can of course change the shared object to fit your needs.

Webhook.lua

  • The script offers 2 webhooks.

    • globalPanic

    • localPanic

If you do not want a webhook to be sent, just leave the string empty. Like this:

WebhookPanicbutton = {

    Colors = {
        ["globalPanic"] = 43775,
        ["localPanic"] = 43775,
    },

    globalPanic = "https://discord.com/api/webhooks/1313140577348354079/Dd36TnZK5HW5dPNt_nHT2B97xR8OUHFkMwm8Uz-Kzh4dwlwcsldUpRGEVVWDVRcjyaOv",
    localPanic = "",
}

In this example, you would not be notified when a player triggers a local panicbutton.


Example Usage

  1. Activating Local Panic

    • Command: /localPanic

    • Keybind: U

  2. Activating Global Panic

    • Command: /globalPanic

    • Keybind: I

  3. Item Requirement

    • Ensure the player has the panicbutton item in their inventory (if needItem is enabled).

  4. Job Restrictions

    • Verify that the player’s job and grade meet the requirements (e.g., police, grade 5).


If you have any further questions, open a ticket on our discord server: discord.gg/core-services

⚙️
Get the script
Support