# sc\_Notify

### Installation

1. Upload the files to your server.
2. Add `ensure notify` to your `server.cfg`.
3. Make sure to configure the `config.lua` to your liking in order to adjust the notification behavior.

***

### Customizing Notifications

Notifications can be configured through the `config.lua` file. The file offers various options to tailor the notifications to your preferences.

1. EnableTestCommand

* Description: Toggles the test command on or off.
* Values:
  * `true`: The test command is active. You can use `/testnotify` to send a test notification.
  * `false`: The test command is disabled.

2. NotifyPosition

* Description: Determines where the notification will be displayed on the screen.
* Values:
  * `top-right`: Top right
  * `top-left`: Top left
  * `bottom-right`: Bottom right
  * `bottom-left`: Bottom left

3. NotifyColors

* Description: Defines the colors for the notification (background, text, border).
* Fields:

  * `background`: Background color (RGBA)
  * `text`: Text color (RGBA)
  * `border`: Border color (RGBA)

  Example: `{ r = 255, g = 255, b = 255, a = 1 }` for white text

4. NotifyStyle

* Description: Additional visual options for the notification.
* Fields:
  * `borderRadius`: Determines how rounded the corners of the notification are.
  * `shadow`: Enables or disables the shadow.
  * `shadowColor`: Determines the shadow color.

***

### Usage

#### Sending a Test Notification

If the test command is enabled in the `config.lua` (`Config.EnableTestCommand = true`), you can enter the command `/testnotify` in-game to see a test notification.

#### Sending Notifications from Other Scripts

Other plugins or scripts can also send notifications by triggering the **`notify:send`** event. Example:

```lua
TriggerEvent('notify:send', 'This is a notification from another plugin!')
```

To send a notification with custom settings (e.g., colors and position):

```lua
TriggerEvent('notify:send', 'Notification with custom colors!', {
    position = "bottom-left", 
    colors = {
        background = { r = 255, g = 0, b = 0, a = 0.8 }, -- red
        text = { r = 255, g = 255, b = 255, a = 1 },      -- white
        border = { r = 255, g = 255, b = 0, a = 1 }        -- yellow
    }
})
```
