Jump to content

[ProgressBar|مساعدة]


Maksoud

Recommended Posts

المحاولة :
 

local start = getTickCount()
function dxDrawLoading (x, y, width, height, x2, y2, size, color, color2, second)
    local now = getTickCount()
    local seconds = second or 5000
    local color = color or tocolor(0,0,0,170)
    local color2 = color2 or tocolor(255,255,0,170)
    local size = size or 1.00
    local with = interpolateBetween(0,0,0,width,0,0, (now - start) / ((start + seconds) - start), "Linear")
    local text = interpolateBetween(0,0,0,100,0,0,(now - start) / ((start + seconds) - start),"Linear")
    dxDrawText ( "Loading ... "..math.floor(text).."%", x2, y2 , width, height, tocolor ( 0, 200, 255, 255 ), size, "pricedown" )
    dxDrawRectangle(x, y ,width ,height -10, color)
    dxDrawRectangle(x, y, with ,height -10, color2)
 end
addEventHandler("onClientGUIClick",root,
function()
if source == ChooseButton then
fadeCamera(false)
setTimer(function()
fadeCamera(true)
dxDrawLoading()
end,5000,1)
guiSetVisible(SkinsWnd,false)
showCursor(false)
end
end
)

 

Link to comment

تفضل وظيفة بسيطة بس 4 أسطر

اخر ثلاث ارقمنات اختيارية ام الباقية مطلوبة

function dxDrawProgressBar(x, y, w, h, progress, pg, bgColor, barColor)
    dxDrawRectangle(x, y, progress / 100 * w, h, barColor or 0xffff0000, pg)
    dxDrawRectangle(x, y, w, h, bgColor, pg)
end
  • Like 2
Link to comment
23 minutes ago, </Mr.Tn6eL> said:

تفضل وظيفة بسيطة بس 4 أسطر

اخر ثلاث ارقمنات اختيارية ام الباقية مطلوبة


function dxDrawProgressBar(x, y, w, h, progress, pg, bgColor, barColor)
    dxDrawRectangle(x, y, progress / 100 * w, h, barColor or 0xffff0000, pg)
    dxDrawRectangle(x, y, w, h, bgColor, pg)
end

ما نجح

:(

Link to comment

كذا ؟
addEventHandler("onClientRender",root,dxDrawProgressBar)

احطه قبل حدث ضغط الزر ولا فى الحدث ؟

جربت الحالتين ما نجح ...

عموما الدي بق يجيب خطأ 

Debugscript : 

ERROR : attempt to preform arithmetic on local 'progress' (a nil value)

Link to comment
function dxDrawProgressBar(x, y, w, h, progress, pg, bgColor, barColor)
    dxDrawRectangle(x, y, progress / 100 * w, h, barColor or 0xffff0000, pg)
    dxDrawRectangle(x, y, w, h, bgColor, pg)
end
addEventHandler("onClientRender",root,dxDrawProgressBar)
addEventHandler("onClientGUIClick",root,
function()
sel = guiGridListGetSelectedItem(SkinsGrid)
if source == ChooseButton then
if sel ~= -1 then
setPlayerSkin(localPlayer,guiGridListGetItemData(SkinsGrid,sel,1))
fadeCamera(false)
setTimer(function()
fadeCamera(true)
setElementPosition(localPlayer,1098.14441,1612.42993,12.54688)
setCameraTarget(localPlayer,localPlayer)
destroyElement(PedSkin)
end,5000,1)
guiSetVisible(SkinsWnd,false)
showCursor(false)
end
end
end
)

 

Edited by Maksoud
Link to comment

جرب هاذا 

function dxDrawProgressBar(x, y, w, h, progress, pg, bgColor, barColor)
    dxDrawRectangle(x, y, progress / 100 * w, h, barColor or 0xffff0000, pg)
    dxDrawRectangle(x, y, w, h, bgColor, pg)
end





function CreateDx ( )
dxDrawProgressBar(270, 256, 275, 25,15,false,tocolor(0,0,0,200),tocolor(0,153,255,255))
end



addEventHandler("onClientGUIClick",root,
function()
sel = guiGridListGetSelectedItem(SkinsGrid)
if source == ChooseButton then
if sel ~= -1 then
setPlayerSkin(localPlayer,guiGridListGetItemData(SkinsGrid,sel,1))
fadeCamera(false)
addEventHandler ( "onClientRender" , root , CreateDx )
setTimer(function()
fadeCamera(true)
setElementPosition(localPlayer,1098.14441,1612.42993,12.54688)
setCameraTarget(localPlayer,localPlayer)
destroyElement(PedSkin)
end,5000,1)
guiSetVisible(SkinsWnd,false)
showCursor(false)
end
end
end
)

 

Link to comment

سويته ب تايمر

و 50 % نجح ..

بس المشكلة هي ::
انه من المفترض انه لما يوصل عند 100 يقف ..

هو يكمل ما يقف 

اكودي :: 

value = 0

function CreateDx ( )
timer1 = setTimer(function()
value = value +1
end,1750,1)
dxDrawProgressBar(445, 420, 500, 25,value,false,tocolor(255,255,255,50),tocolor(1,150,237,255))
if value == 100 then
killTimer(timer1)
end
end

 

Edited by Maksoud
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...