Meters UI
Bu özellikler v1.61 ve daha yeni sürümlerde çalışır.
Last updated
Bu özellikler v1.61 ve daha yeni sürümlerde çalışır.
Last updated
You can create 10 meters in same time. All meters run async.
-- Retrieves meter data from the qadr_ui resource.
-- @return table The meter data.
local meterData = exports["qadr_ui"]:getMeterMain()
-- Clears all meter data.
-- @param meterData The meter data to be cleared.
meterData:clearAllMeter()
-- Adds a meter to the UI container using the provided meter data.
-- You can add up to 10 meters to the container at the same time.
local meter = meterData:addMeterToContainer(uiData)
-- Updates the meter with the given UI data.
-- @param uiData The data to update the meter with.
meter:updateMeter(uiData)
-- Sets a timer for 20 seconds and prints a message when the timer is complete.
-- @param meter The meter object to set the timer on.
-- @param iscomplete A boolean value indicating whether the timer is complete.
meter:SetTimer(second,function(iscomplete)
if iscomplete then
print("timer is complete")
else
print("fail")
end
end)
-- Pauses the timer of the meter.
-- @param meter The meter object to pause the timer of.
-- @return nil
meter:timerPause()
-- Resumes the timer of the given meter.
-- @param meter The meter to resume the timer of.
meter:timerResume()
-- Stops the timer of a meter object.
-- @param meter The meter object to stop the timer of.
-- @return nil
meter:timerStop()
-- Retrieves all active meters from the meterData object.
-- @return table A table containing all active meters.
local getallmeters = meterData:getActiveMeters()
for i,v in pairs(getallmeters) do
-- Retrieves the meter data for the given value 'v' using the 'meterData' object.
-- The retrieved data is stored in the 'meter' variable.
local meter = meterData:getMeter(v)
-- Pauses the timer of a meter object.
-- @param meter The meter object to pause the timer of.
-- @return nil
meter:timerPause()
print(v," paused")
Wait(5000)
-- Resumes the timer of the given meter.
-- @param meter The meter to resume the timer of.
meter:timerResume()
print(v," resumed")
end
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"]:getMeterMain() -- you can get main meter container and use function
local meter = meterData:addMeterToContainer(uiData) -- you can add 10 meter to container same time
if meter then
meter:updateMeter(uiData)
meter:SetTimer(20,function(iscomplete)
print("iscomplete",iscomplete)
if iscomplete then
print("timer is complete")
end
end)
meter:timerPause()
uiData.imgColor = `COLOR_RED`
uiData.meterColor = `COLOR_RED`
uiData.overlayColor = `COLOR_RED`
uiData.secondaryImgColor = `COLOR_RED`
uiData.txd = "blips"
uiData.txn = "blip_fence_building"
uiData.secondaryTxd = "blips"
uiData.secondaryTxn = "blip_deadeye_cross"
uiData.showAlternateIcons = 1
uiData.showBlinkIcon = 1
uiData.showPulse = 1
meter:updateMeter(uiData)
Wait(5000)
meter:timerResume()
uiData.imgColor = `COLOR_YELLOW`
uiData.meterColor = `COLOR_YELLOW`
uiData.overlayColor = `COLOR_YELLOW`
uiData.secondaryImgColor = `COLOR_YELLOW`
uiData.txd = "menu_textures"
uiData.txn = "medal_bank_debt_bronze"
meter:updateMeter(uiData)
Wait(5000)
meter1:timerStop()
end
Wait(2000)
end)