# Meters UI  - OutDated

![](https://580445893-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzf2ZAqGbUPk9K8cVFSgd%2Fuploads%2F9C1qcNu6oUS3mIvQY116%2Fqadr_ui-meters.png?alt=media\&token=739685a8-80b1-419a-a888-09aba0dd7d27)

You can create 5 meters in same time. All meters run async.

### Video

{% embed url="<https://youtu.be/SDiUiglOllY>" %}

### Creating Meter

{% code title="Creating Meter" %}

```lua
local uiData = {
    imgColor =  `COLOR_GREEN`,
    isIconBackgroundVisible = 0,
    meterColor =  `COLOR_GREEN`,
    meterValue =  1.0,
    meterVisible = true,
    overlayColor =  `COLOR_GREEN`,
    overlayTxd = "scoretimer_textures",
    overlayTxn = "SCORETIMER_GENERIC_CROSS",
    overlayVisible =  false,
    secondaryImgColor = `COLOR_PURE_WHITE`,
    secondaryTxd =  "0",
    secondaryTxn = "0",
    showAlternateIcons = 0,
    showBlinkIcon = 0,
    showPulse = 0,
    txd =  "blips",
    txn =  "blip_ambient_train",
    visible = true,
}
local meterData = createMeter(uiData)
```

{% endcode %}

### Update Meter data

{% code title="Update Meter data" %}

```lua
.
.
.
local meterData = createMeter(uiData)
local uiData = {
    txd =  "hud_textures",
    txn =  "bank_debt",
    showBlinkIcon = 0,
    isIconBackgroundVisible = 0,
    showPulse = 1,
}
meterData:updateMeter(uiData) 
```

{% endcode %}

### Create Meter Timer

```lua
.
.
.
local meterData = createMeter(uiData)
local time = 20 -- 20 second
meterData:SetTimer(time,function(iscomplete)
    print(iscomplete) -- when time is over run this line
end)
Wait(3000)
meterData:timerPause()
Wait(2000)
meterData:timerResume()
Wait(2000)
meterData:timerStop() -- if you use this function before not ending time, isComplete return "false"
```

### Command Example

```lua
RegisterCommand("createMeter",function()
    local uiData = {
        imgColor =  `COLOR_GREEN`,
        isIconBackgroundVisible = 0,
        meterColor =  `COLOR_GREEN`,
        meterValue =  1.0,
        meterVisible = true,
        overlayColor =  `COLOR_GREEN`,
        overlayTxd = "scoretimer_textures",
        overlayTxn = "SCORETIMER_GENERIC_CROSS",
        overlayVisible =  false,
        secondaryImgColor = `COLOR_PURE_WHITE`,
        secondaryTxd =  0,
        secondaryTxn = 0,
        showAlternateIcons = 0,
        showBlinkIcon = 0,
        showPulse = 0,
        txd =  "blips",
        txn =  "blip_ambient_train",
        visible = true,
    }
    local meterData = exports["qadr_ui"]:createMeter(uiData)
    local wait = math.random(1000,5000)
    print("wait: "..wait)
    Wait(wait)
    local uiData = {
        txd =  "hud_textures",
        txn =  "bank_debt",
        showBlinkIcon = 0,
        isIconBackgroundVisible = 0,
        showPulse = 0,
    }
    meterData:updateMeter(uiData)
    meterData:SetTimer(20,function(iscomplete)
        print("iscomplete",iscomplete)
        if iscomplete then
            print("timer is complete")
        end
    end)
    wait = math.random(1000,5000)
    print("wait: "..wait)
    Wait(wait)
    print("timer paused")
    meterData:timerPause()
    wait = math.random(1000,5000)
    print("wait: "..wait)
    Wait(wait)
    print("timer resumed")
    meterData:timerResume()
    wait = math.random(1000,5000)
    Wait(wait)
    local luck = math.random(1,2)
    if luck == 1 then
        print("unlucky timer stopped")
        meterData:timerStop()
    end
end)
```


---

# 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://abdulkadir-aktas.gitbook.io/qadr_docs/qadr_ui/meters-ui-outdated.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.
