Functions

Here you will find functions and example code on how to use our Dialog V2 System.

Camera

The Camera can only be invoked on the Client-Side!

exports["is_dialogv2"]:createCamera(entity, data)
  • entity: entity(ped)

  • data(optional): object

    • camera(optional): object

      • position(optional): object

        • x: float

        • y: float

        • z: float

      • offset(optional): object

        • x: float

        • y: float

        • z: float

      • fov(optional): float

      • ease(optional): boolean

      • easeTime(optional): number

    • animation(optional): object

      • dict: string

      • anim: string

Example Usage

-- Example 1

exports["is_dialogv2"]:createCamera(entity)

-- Example 2

exports["is_dialogv2"]:createCamera(entity, {
    camera = {
        position = {
            x = 0.0,
            y = 0.8,
            z = 0.7,
        },
        offset = {
            x = 0.0,
            y = 0.0,
            z = 0.5,
        },
        fov = 65.0,
        ease = true,
        easeTime = 1000,
    },
    animation = {
        dict = "missfbi3_party_d",
        anim = "stand_talk_loop_a_male1",
    },
})

Dialog

The Dialog can only be invoked on the Client-Side!

exports["is_dialogv2"]:showDialog(data)
  • data: object

    • typeEffect(optional): boolean

    • typeEffectSpeed(optional): number

    • allowSkip(optional): boolean

    • title: string

    • message: string

    • chat(optional): object

      • range(optional): float

      • message(optional): boolean

      • answer(optional): boolean

    • audio(optional): object

      • path: string

      • volume(optional): number(0-100)

    • tags(optional): array

      • text: string

      • color: string(hex)

      • icon(optional): string

    • buttons(optional): array

      • type(optional): string("button", "item", "number", "text")

      • text: string

      • onSelect: function(...)

    • items(optional): array

      • name: string(item)

      • path: string(image)

Example Usage

-- Example 1

exports["is_dialogv2"]:showDialog({
    title = "Example Title",
    message = "Example Message",
    buttons = {
        {text = "Example Button 1", onSelect = function(buttonIndex)
            exports["is_dialogv2"]:hideDialog()
            print(("Button: %s"):format(buttonIndex))
        end},
        {type = "button", text = "Example Button 2", onSelect = function(buttonIndex)
            exports["is_dialogv2"]:hideDialog()
            print(("Button: %s"):format(buttonIndex))
        end},
        {type = "number", text = "Your number...", onSelect = function(buttonIndex, value)
            exports["is_dialogv2"]:hideDialog()
            print(("Input: %s"):format(value))
        end},
        {type = "text", text = "Your text...", onSelect = function(buttonIndex, value)
            exports["is_dialogv2"]:hideDialog()
            print(("Input: %s"):format(value))
        end},
    },
})

-- Example 2

exports["is_dialogv2"]:showDialog({
    typeEffect = true,
    typeEffectSpeed = 15,
    allowSkip = false,
    title = "Example Title",
    message = "Example Message",
    tags = {
        {text = "TAG1", color = "#009BFF"},
        {text = "TAG2", color = "#FF425D", icon = "fa-solid fa-house"},
    },
    buttons = {
        {text = "Example Button 1", onSelect = function(buttonIndex)
            exports["is_dialogv2"]:hideDialog()
            print(("Button: %s"):format(buttonIndex))
        end},
        {type = "button", text = "Example Button 2", onSelect = function(buttonIndex)
            exports["is_dialogv2"]:hideDialog()
            print(("Button: %s"):format(buttonIndex))
        end},
        {type = "number", text = "Your number...", onSelect = function(buttonIndex, value)
            exports["is_dialogv2"]:hideDialog()
            print(("Input: %s"):format(value))
        end},
        {type = "text", text = "Your text...", onSelect = function(buttonIndex, value)
            exports["is_dialogv2"]:hideDialog()
            print(("Input: %s"):format(value))
        end},
        {type = "item", text = "Choosed Item", onSelect = function(buttonIndex, item)
            exports["is_dialogv2"]:hideDialog()
            print(("Name: %s, Path: %s, Count: %s, Label: %s"):format(item.name, item.path, item.count, item.label))
        end},
    },
    items = {
        {name = "meth", path = "nui://qb-inventory/html/images/meth_baggy.png"},
        {name = "weed_whitewidow", path = "https://as2.ftcdn.net/v2/jpg/02/16/71/15/1000_F_216711557_4b4flusrgydnwFabeeQMLlZo2Lr85Jw0.jpg"},
        {name = "weed_skunk", path = "/images/weed_baggy.png"},
    },
})

-- Example 3

exports["is_dialogv2"]:showDialog({
    typeEffect = true,
    typeEffectSpeed = 15,
    allowSkip = false,
    title = "Example Title",
    message = "Example Message",
    chat = {
        range = 5.0,
        message = true,
        answer = true,
    },
    audio = {
        path = "audio/2pac.mp3",
        volume = 75,
    },
    tags = {
        {text = "TAG1", color = "#009BFF"},
        {text = "TAG2", color = "#FF425D", icon = "fa-solid fa-house"},
    },
    buttons = {
        {text = "Example Button 1", onSelect = function(buttonIndex)
            exports["is_dialogv2"]:hideDialog()
            print(("Button: %s"):format(buttonIndex))
        end},
        {type = "button", text = "Example Button 2", onSelect = function(buttonIndex)
            exports["is_dialogv2"]:hideDialog()
            print(("Button: %s"):format(buttonIndex))
        end},
        {type = "number", text = "Your number...", onSelect = function(buttonIndex, value)
            exports["is_dialogv2"]:hideDialog()
            print(("Input: %s"):format(value))
        end},
        {type = "text", text = "Your text...", onSelect = function(buttonIndex, value)
            exports["is_dialogv2"]:hideDialog()
            print(("Input: %s"):format(value))
        end},
        {type = "item", text = "Choosed Item", onSelect = function(buttonIndex, item)
            exports["is_dialogv2"]:hideDialog()
            print(("Name: %s, Path: %s, Count: %s, Label: %s"):format(item.name, item.path, item.count, item.label))
        end},
    },
    items = {
        {name = "meth", path = "nui://qb-inventory/html/images/meth_baggy.png"},
        {name = "weed_whitewidow", path = "https://as2.ftcdn.net/v2/jpg/02/16/71/15/1000_F_216711557_4b4flusrgydnwFabeeQMLlZo2Lr85Jw0.jpg"},
        {name = "weed_skunk", path = "images/weed_baggy.png"},
    },
})

Camera & Dialog Usage

-- Example 1

exports["is_dialogv2"]:createCamera(entity)
exports["is_dialogv2"]:showDialog({
    title = "Example Title",
    message = "Example Message",
    buttons = {
        {text = "Example Button 1", onSelect = function(buttonIndex)
            exports["is_dialogv2"]:hideDialog()
            print(("Button: %s"):format(buttonIndex))
        end},
        {type = "button", text = "Example Button 2", onSelect = function(buttonIndex)
            exports["is_dialogv2"]:hideDialog()
            print(("Button: %s"):format(buttonIndex))
        end},
        {type = "number", text = "Your number...", onSelect = function(buttonIndex, value)
            exports["is_dialogv2"]:hideDialog()
            print(("Input: %s"):format(value))
        end},
        {type = "text", text = "Your text...", onSelect = function(buttonIndex, value)
            exports["is_dialogv2"]:hideDialog()
            print(("Input: %s"):format(value))
        end},
    },
})
exports["is_dialogv2"]:destroyCamera()

-- Example 2

exports["is_dialogv2"]:createCamera(entity, {
    camera = {
        position = {
            x = 0.0,
            y = 0.8,
            z = 0.7,
        },
        offset = {
            x = 0.0,
            y = 0.0,
            z = 0.5,
        },
        fov = 65.0,
        ease = true,
        easeTime = 1000,
    },
    animation = {
        dict = "missfbi3_party_d",
        anim = "stand_talk_loop_a_male1",
    },
})
exports["is_dialogv2"]:showDialog({
    typeEffect = true,
    typeEffectSpeed = 15,
    allowSkip = false,
    title = "Example Title",
    message = "Example Message",
    chat = {
        range = 5.0,
        message = true,
        answer = true,
    },
    audio = {
        path = "audio/2pac.mp3",
        volume = 75,
    },
    tags = {
        {text = "TAG1", color = "#009BFF"},
        {text = "TAG2", color = "#FF425D", icon = "fa-solid fa-house"},
    },
    buttons = {
        {text = "Example Button 1", onSelect = function(buttonIndex)
            exports["is_dialogv2"]:hideDialog()
            print(("Button: %s"):format(buttonIndex))
        end},
        {type = "button", text = "Example Button 2", onSelect = function(buttonIndex)
            exports["is_dialogv2"]:hideDialog()
            print(("Button: %s"):format(buttonIndex))
        end},
        {type = "number", text = "Your number...", onSelect = function(buttonIndex, value)
            exports["is_dialogv2"]:hideDialog()
            print(("Input: %s"):format(value))
        end},
        {type = "text", text = "Your text...", onSelect = function(buttonIndex, value)
            exports["is_dialogv2"]:hideDialog()
            print(("Input: %s"):format(value))
        end},
        {type = "item", text = "Choosed Item", onSelect = function(buttonIndex, item)
            exports["is_dialogv2"]:hideDialog()
            print(("Name: %s, Path: %s, Count: %s, Label: %s"):format(item.name, item.path, item.count, item.label))
        end},
    },
    items = {
        {name = "meth", path = "nui://qb-inventory/html/images/meth_baggy.png"},
        {name = "weed_whitewidow", path = "https://as2.ftcdn.net/v2/jpg/02/16/71/15/1000_F_216711557_4b4flusrgydnwFabeeQMLlZo2Lr85Jw0.jpg"},
        {name = "weed_skunk", path = "images/weed_baggy.png"},
    },
})
exports["is_dialogv2"]:destroyCamera({
    ease = true,
    easeTime = 1000,
})

Last updated