> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rktscripts.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Firework System

> Custom Firework.

# 📥 Installation

1. **Download** the script through your [FiveM Keymaster](https://keymaster.fivem.net/) account.

2. The script requires [xsound ](https://github.com/Xogy/xsound) to function correctly.

3. Extract the downloaded `.zip` file.

4. Place the extracted folder inside your `resources` directory on your FiveM server.

5. Open your `server.cfg` and add the following line at the end to make sure the script starts correctly on server boot:

   ```cfg theme={null}
   ensure xsound
   ensure rkt_firework
   ```

6. Save the `server.cfg` file.

7. Restart your server or run the following commands in your server console to load the script without restarting:

   ```bash theme={null}
   refresh
   ensure xsound
   ensure rkt_firework
   ```

✅ **Done!** The script should now be running and ready to use.\
No additional dependencies are required.

# ⚙️ Configuration

```lua shared/shared.lua theme={null}
    ['simple'] = {
        -- URL of the video that provides the audio for the firework effect
        -- If you don't want to use an animation, set this to false.
        video = 'https://youtu.be/yrwbpO-zAWY',

        -- Main animation: { dict, animName }
        anim = { "missmic4premiere", "interview_short_lazlow" },

        -- List of offsets for each particle effect (relative to the base coordinate)
        offsets = {
            { x = 0, y = 0, z = 12 }, -- 1st particle: center, 12 units above
            { x = 3, y = 0, z = 12 }, -- 2nd particle: 3 units to the side (x)
            { x = 0, y = 3, z = 12 }, -- 3rd particle: 3 units forward (y)
            { x = 0, y = 3, z = 12 }, -- 4th particle (repeated)
            { x = 0, y = 3, z = 12 }, -- 5th particle (repeated)
            { x = 0, y = 3, z = 12 }, -- 6th particle (repeated)
            { x = 0, y = 3, z = 12 }, -- 7th particle (repeated)
        },

        -- Wait time between each particle (in milliseconds)
        delays = { 500, 400, 300, 200, 100, 700, 0 },

        -- Name of the prop object that will be spawned (e.g., firework shell or launcher)
        prop = "rojao_simples",

        -- Particle effect: { asset, effect name }
        particle = { 
            "scr_sm_counter",        -- the asset that contains the particle effects
            "scr_sm_counter_chaff"   -- specific effect name within the asset
        },

        -- Attachment configuration for holding the prop in the player's hand/body
        -- If you don't want to use attachment, set this to false.
        attach = {
            -- Animation dictionary and name used while holding the prop
            anim = { dict = "missmic4premiere", anim = "interview_short_lazlow" },

            -- Position and rotation offsets relative to the bone
            pos = { vec3(0.1, 0.1, 0.0), vec3(190.0, 0.0, 0.0) },

            -- Bone ID to attach the prop to (57005 = right hand)
            bone = 57005
        }
    },
```

# 🎈 How to Use

To trigger the firework, simply call the event **`rkt_rojao:start`** and pass the index key that matches your `Config.fireworks` entry.

***

```lua client theme={null}
    -- Client-side example
    -- Replace 'simple' with the key of the firework config you want
    TriggerEvent('rkt_rojao:start', 'simple')
```

```lua server theme={null}
    -- Server-side example
    -- Replace 'simple' with the key of the firework config you want
    TriggerClientEvent("rkt_rojao:start", source, "simple")
```
