# MARRIAGE

***

### 1) Overview

Risk Marriage Script allows players to get married and divorced in your FiveM server. The script includes:

* 💒 Marriage system with customizable locations and costs
* 💔 Divorce system with separate locations
* 💍 Optional item requirements (wedding rings)
* 🔔 Discord webhook notifications
* 🗺️ Configurable blips, NPCs, and markers
* 🌐 Full localization support
* 🎨 Custom UI with themes

***

### 2) Basic Configuration

#### Framework Detection

```lua
RISK.Framework = "auto"
```

**Options:** `"auto"`, `"esx"`, `"qb"`, `"qbox"`\
**Recommended:** Leave as `"auto"` for automatic detection

#### Interaction Range

```lua
Config.InteractionRange = 2.0
```

Distance in meters players must be within to interact with NPCs/markers

***

### 3) Marriage Configuration

#### Location & Cost

```lua
Config.Location = vec4(-781.8509, 2.7381, 41.8795, 204.3262)
Config.MarriageCost = 10000
Config.MarriageAccount = 'cash'
```

* **Location:** Marriage NPC/marker coordinates (x, y, z, heading)
* **MarriageCost:** Price to get married
* **MarriageAccount:** Payment method (`'cash'` or `'bank'`)

#### Item Requirements

```lua
Config.CheckItem = true
Config.MarriageItem = 'wedding_ring'
Config.MarriageItemLabel = 'Wedding Ring'
Config.ItemAmount = 1
Config.BothPlayersNeedItem = true
Config.RemoveItemAfter = true
```

**Item Configuration:**

* **CheckItem:** Enable/disable item requirement
* **MarriageItem:** Item name (must match your items database)
* **MarriageItemLabel:** Display name shown in notifications
* **ItemAmount:** Quantity required
* **BothPlayersNeedItem:** If `true`, both partners need the item
* **RemoveItemAfter:** Remove item(s) after successful marriage

***

### 4) Visual Configuration

#### Marriage Blip

```lua
Config.Blip = {
    Enabled = true,
    Sprite = 189,
    Color = 46,
    Scale = 0.9,
    Text = "Marry",
}
```

[Blip Sprites Reference](https://docs.fivem.net/docs/game-references/blips/)

#### Marriage NPC

```lua
Config.NPC = {
    Enabled = true,
    Model = "cs_priest",
    Scenario = "WORLD_HUMAN_STAND_IDLE",
    Freeze = true,
}
```

* **Model:** Ped model (e.g., `"cs_priest"`, `"a_m_y_business_01"`)
* **Scenario:** Animation ([Scenario List](https://wiki.rage.mp/index.php?title=Scenarios))
* **Freeze:** Prevent NPC from walking

#### Marriage Marker

```lua
Config.Marker = {
    Enabled = false,
    Type = 29,
    Scale = vec3(1.5, 1.5, 1.0),
    Color = { r = 255, g = 223, b = 0, a = 150 },
}
```

**Note:** Typically use either NPC or marker, not both\
[Marker Types Reference](https://docs.fivem.net/docs/game-references/markers/)

***

### 5) Divorce Configuration

#### Location & Cost

```lua
Config.DivorceLocation = vec4(-760.3580, -18.8865, 41.0811, 30.7372)
Config.DivorceCost = 7500
Config.DivorceAccount = 'bank'
```

#### Divorce Blip

```lua
Config.DivorceBlip = {
    Enabled = true,
    Sprite = 255,
    Color = 46,
    Scale = 0.9,
    Text = "Divorce",
}
```

#### Divorce NPC

```lua
Config.DivorceNPC = {
    Enabled = true,
    Model = "cs_priest",
    Scenario = "WORLD_HUMAN_STAND_IDLE",
    Freeze = true,
}
```

#### Divorce Marker

```lua
Config.DivorceMarker = {
    Enabled = false,
    Type = 29,
    Scale = vec3(1.5, 1.5, 1.0),
    Color = { r = 255, g = 0, b = 0, a = 150 },
}
```

***

### 6) Notification System

#### Custom Notifications

```lua
Config.UseCustomNotify = true
Config.UseCustomHelpNotify = true

Config.Functions = {
    notify = function(ntype, title, text, time)
        exports["risk-notify"]:Notify({
            type = ntype or "info",
            title = title or "",
            message = text or "",
            duration = time or 8000
        })
    end,
    helpnotify = function(key, text)
        exports["risk-notify"]:HelpNotify(key, text)
    end,
}
```

**To use default notifications:**

```lua
Config.UseCustomNotify = false
Config.UseCustomHelpNotify = false
```

**To integrate other notification systems:**

```lua
Config.Functions = {
    notify = function(ntype, title, text, time)
        -- Replace with your notification export
        exports["your-notify"]:ShowNotification(text, ntype)
    end,
    helpnotify = function(key, text)
        -- Replace with your help text system
        exports["your-notify"]:ShowHelp(text)
    end,
}
```

***

### 7) Localization / Strings

All UI text can be customized in `Config.Strings`:

```lua
Config.Strings = {
    -- Interaction prompts
    press_to_marry = "Press E to marry",
    press_to_divorce = "Press E to start divorce",
    none_nearby = "No one nearby",
    busy_priest = "Someone is already talking to the priest.",
    
    -- UI text
    cost_select_hint = "Select the surname you will both carry",
    cost_selected_tpl = "%s will be your shared surname",
    ui_marry_title = "Do you want to get married?",
    ui_accept_marry_title = "Do you accept the marriage?",
    ui_divorce_title = "Do you want a divorce?",
    ui_costs_title = "MARRIAGE COSTS",
    ui_divorce_costs_title = "DIVORCE COSTS",
    ui_accept = "ACCEPT",
    ui_cancel = "CANCEL",
    ui_info_will_be_tpl = "If you accept, your name will be %s",
    
    -- Notifications
    notify_title = "BIG NEWS",
    notification_title = "Marriage",
    notify_couple_tpl = "%s and %s just got married!",
    notify_family_tpl = "From now on they are known as the %s family",
    notify_divorce_title = "BREAKING",
    notify_divorce_tpl = "%s and %s got divorced.",
    
    -- Status messages
    already_married = "You are already married.",
    not_married = "You are not married.",
    partner_not_nearby = "Your partner is not nearby",
    not_enough_money = "Not enough money",
    missing_item = "Required item missing",
    partner_missing_item = "%s doesn't have %s",
    item_required = "You don't have the required item %s",
    
    -- Action responses
    has_accepted = "has accepted",
    has_declined = "has declined the marriage",
    has_accepted_divorce = "has accepted the divorce",
    has_declined_divorce = "has declined the divorce",
}
```

**Translation tip:** Use `%s` as placeholder for dynamic values (names, items, etc.)

***

### 8) Discord Webhooks

#### Marriage Webhook

```lua
WebhookConfig.Marriage = {
    Enabled = true,
    WebhookURL = "https://discord.com/api/webhooks/YOUR_WEBHOOK_HERE",
    Username = "💒 Wedding Chapel",
    AvatarURL = "https://files.catbox.moe/qfwy1k.png",
    Color = 15844367,
    AuthorIconURL = "https://files.catbox.moe/qfwy1k.png",
    ThumbnailURL = "https://files.catbox.moe/c89s4v.webp",
    BannerURL = "https://files.catbox.moe/8am1my.avif",
    FooterIconURL = "https://files.catbox.moe/c89s4v.webp",
    
    Locale = {
        author_name = "💒 Marriage Announcement",
        family_text = "FAMILY",
        description = "Two hearts have become one!",
        partner1_label = "👰 Partner 1",
        partner2_label = "🤵 Partner 2",
        new_family_label = "💍 New Family Name",
        date_label = "📅 Marriage Date",
        footer_text = "❤️ May your love last forever ❤️"
    }
}
```

#### Divorce Webhook

```lua
WebhookConfig.Divorce = {
    Enabled = true,
    WebhookURL = "https://discord.com/api/webhooks/YOUR_WEBHOOK_HERE",
    Username = "💔 Court House",
    AvatarURL = "https://files.catbox.moe/qfwy1k.png",
    Color = 15158332,
    AuthorIconURL = "https://files.catbox.moe/qfwy1k.png",
    ThumbnailURL = "https://files.catbox.moe/3twuw7.png",
    BannerURL = "https://files.catbox.moe/2mkmqr.png",
    FooterIconURL = "https://files.catbox.moe/qfwy1k.png",
    
    Locale = {
        author_name = "💔 Divorce Announcement",
        title = "💔 **DIVORCE**",
        description = "A marriage has ended",
        partner1_label = "👤 Former Partner 1",
        partner2_label = "👤 Former Partner 2",
        date_label = "📅 Divorce Date",
        footer_text = "💔 Sometimes love fades away..."
    }
}
```

**Discord Embed Colors:**

* Marriage (Gold): `15844367` (#F1C40F)
* Divorce (Red): `15158332` (#E74C3C)
* Use [Discord Color Picker](https://leovoel.github.io/embed-visualizer/) to customize

***

### 9) UI Theming

Customize UI colors in `html/css/config.css`:

```css
:root {
    --main-color: #FDFE02;        /* Primary accent color */
    --main-color-2: #FDFE0287;    /* Semi-transparent accent */
    --main-color-3: #B0B11A63;    /* Darker accent variant */
    --main-color-4: #97972A;      /* Border/secondary color */
    --main-color-5: #53531F;      /* Background/darkest */
}
```

**Color themes examples:**

```css
/* Romantic Red Theme */
:root {
    --main-color: #FF1744;
    --main-color-2: #FF174487;
    --main-color-3: #C2185B63;
    --main-color-4: #AD1457;
    --main-color-5: #880E4F;
}

/* Elegant Gold Theme */
:root {
    --main-color: #FFD700;
    --main-color-2: #FFD70087;
    --main-color-3: #DAA52063;
    --main-color-4: #B8860B;
    --main-color-5: #654321;
}

/* Modern Blue Theme */
:root {
    --main-color: #2196F3;
    --main-color-2: #2196F387;
    --main-color-3: #1976D263;
    --main-color-4: #1565C0;
    --main-color-5: #0D47A1;
}
```

***

### 10) Complete Configuration Examples

#### Example 1: Free Marriage, No Items

```lua
Config.MarriageCost = 0
Config.CheckItem = false
Config.DivorceCost = 0
```

#### Example 2: Expensive Marriage with Item Requirement

```lua
Config.MarriageCost = 50000
Config.MarriageAccount = 'bank'
Config.CheckItem = true
Config.MarriageItem = 'diamond_ring'
Config.MarriageItemLabel = 'Diamond Ring'
Config.ItemAmount = 1
Config.BothPlayersNeedItem = true
Config.RemoveItemAfter = true
Config.DivorceCost = 25000
Config.DivorceAccount = 'bank'
```

#### Example 3: Church Wedding (Custom Location)

```lua
Config.Location = vec4(-766.28, -23.41, 41.08, 117.36)
Config.NPC = {
    Enabled = true,
    Model = "cs_priest",
    Scenario = "WORLD_HUMAN_AA_SMOKE",
    Freeze = true,
}
Config.Blip = {
    Enabled = true,
    Sprite = 305,
    Color = 0,
    Scale = 0.9,
    Text = "Wedding Chapel",
}
```

#### Example 4: City Hall (Minimal Setup)

```lua
Config.Location = vec4(232.45, -410.98, 48.11, 158.74)
Config.MarriageCost = 5000
Config.CheckItem = false
Config.NPC.Model = "a_m_y_business_01"
Config.Blip.Text = "City Hall - Marriage"
Config.DivorceLocation = vec4(232.45, -415.98, 48.11, 158.74)
Config.DivorceCost = 2500
Config.DivorceBlip.Text = "City Hall - Divorce"
```

***

### 11) How It Works

#### Marriage Process

1. **Both players** go to the marriage location
2. One player presses **E** to start the marriage process
3. They select which surname to use (theirs or their partner's)
4. **Both players** must accept the marriage proposal
5. Payment is charged and item removed (if configured)
6. Names are updated in the database
7. Discord webhook notification sent (if enabled)
8. In-game notification shown to all players

#### Divorce Process

1. **Both married players** go to the divorce location
2. One player presses **E** to start divorce
3. **Both players** must accept the divorce
4. Payment is charged (from the player who initiated)
5. Names are restored to original
6. Marriage record deleted from database
7. Discord webhook notification sent (if enabled)
8. In-game notification shown to all players

#### Name System

* **Marriage:** Players adopt the chosen surname
* **Divorce:** Players' names are restored to their original first and last names
* Names are automatically synced with ESX/QBCore/QBox databases

***

### 12) Database

The script automatically creates this table:

```sql
CREATE TABLE IF NOT EXISTS `risk_marry_marriages` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `a_id` varchar(100) NOT NULL,
  `b_id` varchar(100) NOT NULL,
  `surname` varchar(100) NOT NULL,
  `a_first_orig` varchar(100) DEFAULT NULL,
  `a_last_orig` varchar(100) DEFAULT NULL,
  `b_first_orig` varchar(100) DEFAULT NULL,
  `b_last_orig` varchar(100) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_marriage` (`a_id`,`b_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```

**No manual setup required** — the script handles everything automatically.

***

### 13) Troubleshooting

#### ❌ "Someone is already talking to the priest"

**Cause:** Another player is currently in the marriage flow\
**Solution:** Wait for the other player to finish or cancel

#### ❌ "No one nearby"

**Possible causes:**

* Partner is too far away (must be within 5 meters)
* Only one player at the location
* Player is already married (check database)

**Solution:** Both players stand close together at the location

#### ❌ "You don't have the required item"

**Cause:** `Config.CheckItem = true` but player lacks the item\
**Solution:**

* Give the item: `/giveitem [id] wedding_ring 1`
* Or disable: `Config.CheckItem = false`

#### ❌ "Not enough money"

**Cause:** Player doesn't have sufficient cash/bank balance\
**Solution:**

* Lower `Config.MarriageCost` or `Config.DivorceCost`
* Give money to the player
* Change `Config.MarriageAccount` from `'bank'` to `'cash'` (or vice versa)

#### ❌ Marriage UI won't open

**Possible causes:**

* Too far from location (must be within `Config.InteractionRange`)
* NPC not spawned correctly
* Already married

**Solution:**

* Check server console for errors
* Verify coordinates in config
* Restart the resource: `/restart risk-marry`

#### ❌ Names not updating after marriage/divorce

**Possible causes:**

* Database connection issue
* Framework detection failed
* Character data cache

**Solution:**

* Verify framework is detected: Check `RISK.Framework` in config
* Restart framework resource
* Have players relog

#### ❌ Discord webhook not working

**Possible causes:**

* Invalid webhook URL
* Webhook deleted from Discord
* `Enabled = false`

**Solution:**

* Create new webhook in Discord channel settings
* Copy full webhook URL including `/12345/token`
* Set `WebhookConfig.Marriage.Enabled = true`

#### ❌ Custom notification not showing

**Cause:** Notification resource not started or incorrect export name\
**Solution:**

```lua
Config.UseCustomNotify = false
```

This will use default FiveM notifications

***

### 14) Best Practices

✅ **Test with two accounts** before going live\
✅ **Use bank account** for larger costs (`Config.MarriageAccount = 'bank'`)\
✅ **Set reasonable prices** based on your economy (suggested: $5k-$25k)\
✅ **Position NPCs away from traffic** to avoid accidental interruptions\
✅ **Use unique blip sprites** to differentiate marriage/divorce locations\
✅ **Customize strings** to match your server's language/theme\
✅ **Test webhooks** in a private Discord channel first\
✅ **Backup your database** before making changes

***

### 15) Support & Updates

**Having issues?**

1. Check this documentation first
2. Verify all config options are correct
3. Check server console for error messages
4. Test with default config values

**Need customization?**\
All player-facing features are configurable through `config.lua`, `webhook_config.lua`, and `html/css/config.css`

***


---

# 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://risk-scripts.gitbook.io/risk-scripts/scripts/marriage.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.
