# X\_HUD\_CallPlayer

### 🌟 Overview

`X_HUD_CallPlayer` provides a modern and efficient way for admins to communicate with players directly through in-game notifications. The system features a glass UI effect, multilingual support, and advanced logging capabilities. It integrates seamlessly with popular frameworks like ESX and QB-Core and supports detailed Discord webhooks for admin actions.

***

### ✨ Features

* **Admin Communication**: Send direct messages to players using simple commands.
* **Modern UI**: Glass effect with customizable colors, fonts, and layout.
* **Framework Support**: Compatible with ESX and QB-Core.
* **Multilingual Support**: English, German, French, Italian, Spanish, and easy expansion.
* **Discord Webhooks**: Detailed logs with player identifiers (Steam, License, Discord, IP, etc.).
* **TxAdmin Integration**: Handle warnings and direct messages from TxAdmin.
* **Customizable Notifications**: Adjust the appearance of notifications via `html/config.js`.

***

### 🛠️ Installation

1. **Download the Script**:
   * Download the script from the [Tebex Store](https://kimi.ai/chat/d00d4m46toidmmfar160#) or [GitHub](https://kimi.ai/chat/d00d4m46toidmmfar160#).
2. **Extract the Folder**:
   * Extract the downloaded folder to your FiveM `resources` directory.
3. **Update `server.cfg`**:
   * Add `ensure X_HUD_CallPlayer` to your `server.cfg` file.
4. **Restart Your Server**:
   * Restart your server to load the new resource.

***

### 📖 Usage

#### Admin Commands

* **`/callplayer [ID] [Message]`**: Sends a message to a specific player.

#### Example Usage

```lua
/callplayer 1 "Please report to the admin base for assistance."
```

***

### ⚙️ Configuration

#### Server-Side Configuration (`config.lua`)

**Language Setting**

```lua
Config.Language = "en" -- Available: "en", "de", "fr", "it", "es"
```

**Command Settings**

```lua
Config.CommandName = "callplayer" -- Name of the command
Config.DefaultMessage = "An admin wants to speak with you in support!" -- Default message
Config.CommandCooldown = 30 -- Cooldown in seconds between command uses (per admin)
```

**Permission Settings**

```lua
Config.PermissionGroups = { -- Groups that can use the command
    "admin",
    "mod", 
    "superadmin",
    "god"
}
```

**Framework Settings**

```lua
Config.Framework = "auto" -- "auto", "esx" or "qbcore"
Config.UseNewESX = true -- true for Export (new ESX), false for TriggerEvent (old ESX)
```

**Discord Webhook**

```lua
Config.UseDiscordLogs = true -- Enable Discord logs
Config.DiscordWebhook = "https://discord.com/api/webhooks/..." -- Discord Webhook URL
Config.DiscordBotName = "Call Player Logs" -- Name of the Discord bot
Config.DiscordColor = 15158332 -- Red (equivalent to FF0000 in Hex)
Config.DiscordFooterText = "X_HUD_CallPlayer" -- Text in the embed footer
Config.DiscordAvatarURL = "" -- Avatar URL for the Discord bot
Config.DiscordTitle = "Admin Call Player System" -- Title of the embed
Config.DiscordDescription = "Admin called a player" -- Description of the embed
Config.DiscordShowTimestamp = true -- Show timestamp in footer
```

**TxAdmin Integration**

```lua
Config.UseTxAdminWarnings = true -- Enable txAdmin warning event handling
Config.UseTxAdminDirectMessages = true -- Enable txAdmin direct message event handling
```

***

### 🎨 UI Customization (`html/config.js`)

#### Notification Duration and Effects

```javascript
notificationDuration: 12500, // Duration of notification in ms
fadeOutTime: 1000, // Time to fade out in ms
```

#### Position Settings

```javascript
windowPositionY: 5, // Position of window from bottom screen edge in %
iconOffsetY: 40, // Distance of icon from window in px
verticalPosition: 5, // Vertical position for window in %
iconPositionOffset: 50, // Distance between icon and window in px
```

#### Style Settings

```javascript
glassBlurStrength: 2.0, // Strength of glass effect
glassTransparency: 0.4, // Transparency of glass effect
borderWidth: 3, // Width of border in px
borderColor: "rgba(87, 87, 87, 0.5)", // Color of border
windowGlowStrength: "0 0 10px", // Strength of window glow effect
titleGlowStrength: "0 0 3px", // Strength of title glow effect
uiScale: 0.9, // Scale factor for UI size (1.0 = 100%)
```

#### Notification Types

```javascript
notificationTypes: {
    default: {
        icon: "warning", // Default icon (ionicons name)
        label: "", // No label for default messages
        titlePrefix: "Message from:", // Title prefix for default messages
        
        // Colors for this notification type
        accentColor: "rgba(255, 0, 0, 1.0)", // Main color for UI elements (Red)
        textColor: "rgba(255, 255, 255, 1.0)", // Text color
        shadowColor: "rgba(0, 0, 0, 0.5)", // Shadow color
        windowGlowColor: "rgba(255, 0, 0, 1.0)", // Color of window glow effect
        titleGlowColor: "rgba(255, 0, 0, 1.0)", // Color of title glow effect
        alertIconColor: "rgba(255, 0, 0, 1.0)", // Color of icon
        durationBarGlowColor: "rgba(255, 0, 0, 0.6)" // Color of progress bar
    },
    warn: {
        icon: "warning", // Warning icon (ionicons name)
        label: "WARNING",
        titlePrefix: "Warning from:", // Title prefix for warnings
        
        // Colors for this notification type
        accentColor: "rgba(255, 165, 0, 1.0)", // Main color for UI elements (Orange)
        textColor: "rgba(255, 255, 255, 1.0)", // Text color
        shadowColor: "rgba(0, 0, 0, 0.5)", // Shadow color
        windowGlowColor: "rgba(255, 165, 0, 1.0)", // Color of window glow effect
        titleGlowColor: "rgba(255, 165, 0, 1.0)", // Color of title glow effect
        alertIconColor: "rgba(255, 165, 0, 1.0)", // Color of icon
        durationBarGlowColor: "rgba(255, 165, 0, 0.6)" // Color of progress bar
    },
    dm: {
        icon: "information-circle",
        label: "DM",
        titlePrefix: "Message from:",
        
        accentColor: "rgba(100, 149, 237, 1.0)",
        textColor: "rgba(255, 255, 255, 1.0)", 
        shadowColor: "rgba(0, 0, 0, 0.5)",
        windowGlowColor: "rgba(100, 149, 237, 1.0)",
        titleGlowColor: "rgba(100, 149, 237, 1.0)",
        alertIconColor: "rgba(100, 149, 237, 1.0)", 
        durationBarGlowColor: "rgba(100, 149, 237, 0.6)"
    }
}
```

#### Font Settings

```javascript
fontFamily: "Poppins", // Font for UI (available options: Poppins, Montserrat, Pacifico, Kanit, Gidole, Dancing Script)
useCustomFonts: true, // Enable custom fonts
```

***

### 📤 Discord Webhook Setup

#### Features of Discord Logs

* **Player Identifiers**: Steam, License, Discord, FiveM, IP address, and more.
* **RP Names**: If available through the framework.
* **Detailed Information**: Player jobs, money, status, server info, online time, location, and date/time.

#### Configuration in `config.lua`

```lua
Config.UseDiscordLogs = true -- Enable Discord logs
Config.DiscordWebhook = "https://discord.com/api/webhooks/..." -- Discord Webhook URL
Config.DiscordBotName = "Call Player Logs" -- Name of the Discord bot
Config.DiscordColor = 15158332 -- Red (equivalent to FF0000 in Hex)
Config.DiscordFooterText = "X_HUD_CallPlayer" -- Text in the embed footer
Config.DiscordAvatarURL = "" -- Avatar URL for the Discord bot
Config.DiscordTitle = "Admin Call Player System" -- Title of the embed
Config.DiscordDescription = "Admin called a player" -- Description of the embed
Config.DiscordShowTimestamp = true -- Show timestamp in footer
```

***

### 🔄 TxAdmin Integration

#### Configuration

```lua
Config.UseTxAdminWarnings = true -- Enable txAdmin warning event handling
Config.UseTxAdminDirectMessages = true -- Enable txAdmin direct message event handling
```

***

### 🔄 Troubleshooting

#### Common Issues

1. **Notification Not Appearing**:
   * Ensure the script is properly loaded and enabled in `server.cfg`.
   * Check for typos in the command name or event names.
   * Verify that the player ID is correct.
2. **Discord Logs Not Working**:
   * Ensure the Discord webhook URL is correct.
   * Check if the Discord bot has the necessary permissions.
   * Verify that `Config.UseDiscordLogs` is set to `true`.
3. **TxAdmin Integration Not Working**:
   * Ensure TxAdmin is properly installed and configured.
   * Verify that `Config.UseTxAdminWarnings` and `Config.UseTxAdminDirectMessages` are set to `true`.

***

### 📥 Download & Support

* **Tebex Store**: [Download Link](https://kimi.ai/chat/d00d4m46toidmmfar160#)
* **Discord Support**: [Join Discord](https://kimi.ai/chat/d00d4m46toidmmfar160#)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fiveworld.gitbook.io/fiveworld-docs/x_hud_callplayer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
