# ds-cutscene

<div align="center"><img src="/files/8wwI4kiLz5xp4mcHqOtG" alt=""></div>

[<mark style="color:purple;">**View on Tebex**</mark> ](https://dolajiscripts.com/package/5162488)<mark style="color:purple;">**| CFX Fourm Post |**</mark> [<mark style="color:purple;">**Youtube Video**</mark>](https://youtu.be/r-QPtQiwWhw) <mark style="color:purple;">**|**</mark> [<mark style="color:purple;">**Discord**</mark>](https://discord.gg/vhF9ke3hJG)

## Installaction

### Start

1. Extract `ds-cutscene.zip` and place it into your resource folder.
2. Setup`config.lua` (⚠️see [#CONFIGURATION](#configuration) for instructions).&#x20;
3. Add`ensure ds-cutscene`to your server start config (place it anywhere below the framework resources).

### Configuration

{% hint style="warning" %}
Please go through **all** configurable options & settings in `config.lua` and configure them to your server's preferences.

Also please read the comments at the end of each line, for a brief information on what the option does.&#x20;
{% endhint %}

### Add Trigger Event

{% tabs %}
{% tab title="QBCore" %}
put his line on top of the `qb-clothing/client/main.lua`

```lua
local CreateFirstCharacter = false
```

open `qb-clothing/client/main.lua` and replace this close callback.

```lua
RegisterNUICallback('close', function()
    SetNuiFocus(false, false)
    if CreateFirstCharacter then 
        TriggerEvent('ds-cutscene:start')
    end
    CreateFirstCharacter = false
    creatingCharacter = false
    disableCam()

    FreezeEntityPosition(PlayerPedId(), false)
end)
```

find `qb-clothes:client:CreateFirstCharacter` event and replace with this.

```lua
RegisterNetEvent('qb-clothes:client:CreateFirstCharacter')
AddEventHandler('qb-clothes:client:CreateFirstCharacter', function()
    CreateFirstCharacter = true
    QBCore.Functions.GetPlayerData(function(PlayerData)
        local skin = "mp_m_freemode_01"
        openMenu({
            {menu = "character", label = "Character", selected = true},
            {menu = "clothing", label = "Features", selected = false},
            {menu = "accessoires", label = "Accessories", selected = false}
        })

        if PlayerData.charinfo.gender == 1 then
            skin = "mp_f_freemode_01"
        end

        ChangeToSkinNoUpdate(skin)
        SendNUIMessage({
            action = "ResetValues",
        })
    end)
end)
```

{% endtab %}

{% tab title="ESX" %}
open `esx_skin/client/main.lua` and edit replace below code or add lines as per example image.

```lua
local newCharacter = false  --- add this line before below function
function OpenSaveableMenu(submitCb, cancelCb, restrict)
    TriggerEvent('skinchanger:getSkin', function(skin) lastSkin = skin end)

    OpenMenu(function(data, menu)
        menu.close()
        DeleteSkinCam()

        TriggerEvent('skinchanger:getSkin', function(skin)
            TriggerServerEvent('esx_skin:save', skin)
            if newCharacter then --- add this lines here
                TriggerEvent('ds-cutscene:start') --- add this lines here
                newCharacter = false --- add this lines here
            end
            if submitCb ~= nil then
                submitCb(data, menu)
            end
        end)

    end, cancelCb, restrict)
end


AddEventHandler('esx_skin:playerRegistered', function()
    CreateThread(function()
        while not ESX.PlayerLoaded do
            Wait(100)
        end

        if firstSpawn then
            newCharacter = true  --- add this lines here
            ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
                if skin == nil then
                    TriggerEvent('skinchanger:loadSkin', {sex = 0}, OpenSaveableMenu)
                    Wait(100)
                    skinLoaded = true
                else
                    TriggerEvent('skinchanger:loadSkin', skin)
                    Wait(100)
                    skinLoaded = true
                end
            end)
            
            firstSpawn = false
        end
    end)
end)
```

![](/files/k3XkKgmF38nY12yupYxD)
{% endtab %}

{% tab title="Other" %}
Trigger below client side event when you want to start cutscene.

you can trigger after player close clothing menu on player create new creaction.

```lua
TriggerEvent('ds-cutscene:start')
```

{% endtab %}

{% tab title="fivem-appearance" %}
Find `qb-clothes:client:CreateFirstCharacter` event and replace with this.

```lua
RegisterNetEvent('qb-clothes:client:CreateFirstCharacter', function()
    QBCore.Functions.GetPlayerData(function(pd)
        local skin = 'mp_m_freemode_01'
        if pd.charinfo.gender == 1 then
            skin = "mp_f_freemode_01"
        end
        exports['fivem-appearance']:setPlayerModel(skin)
        -- Fix for tattoo's appearing when creating a new character
        local ped = PlayerPedId()
        exports['fivem-appearance']:setPedTattoos(ped, {})
        ClearPedDecorations(ped)
        QBCore.Functions.TriggerCallback("QBCore:HasPermission", function(permission)
            local config = getConfigForPermission(permission)
            exports['fivem-appearance']:startPlayerCustomization(function(appearance)
                if (appearance) then
                    TriggerServerEvent('fivem-appearance:server:saveAppearance', appearance)
                    --TriggerEvent('introCinematic:start')
                    TriggerEvent('ds-cutscene:start')  
                end
            end, config)
        end, Config.PedMenuGroup)
    end)
end)

```

{% endtab %}

{% tab title="illenium-appearance" %}
go to `illenium-appearance/client/client.lua` and replace this function

```lua
function InitializeCharacter(gender, onSubmit, onCancel)
    SetInitialClothes(Config.InitialPlayerClothes[gender])
    local config = getNewCharacterConfig()
    TriggerServerEvent("illenium-appearance:server:ChangeRoutingBucket")
    client.startPlayerCustomization(function(appearance)
     TriggerEvent('ds-cutscene:start')
        if (appearance) then
            TriggerServerEvent("illenium-appearance:server:saveAppearance", appearance)
            if onSubmit then
                onSubmit()
            end
        elseif onCancel then
            onCancel()
        end
        Framework.CachePed()
        TriggerServerEvent("illenium-appearance:server:ResetRoutingBucket")
    end, config)
end
```

{% endtab %}
{% endtabs %}


---

# 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://docs.dolajiscripts.com/resources/ds-cutscene.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.
