0 Üye ve 1 Ziyaretçi konuyu incelemekte.
createProgressBar(x,y,g,u,ms,arkaArenk,icRenk,barRenk,gui)
destroyProgressBar(barid)
getBarProgress(barid)
local barlar = {}function createProgressBar(x,y,g,u,ms,arkaArenk,icRenk,barRenk,gui) local sayi = #barlar +1 -- barlar tablosunun büyüklüğünden +1 sayı ekledik if sayi == 1 then addEventHandler("onClientRender",root,render) end -- eğer 1. bar ise render ekledik if not barlar[sayi] then barlar[sayi] = {} end -- eğer sayi barlar tablosunda yoksa içinde tablo açtık local b = barlar[sayi] -- kısaltma olsun diye b.x,b.y,b.g,b.u = x,y,g,u -- konum vs kaydettik b.sure = ms or 10000 -- ms kaydettik b.arenk = arkaArenk or tocolor(0,0,0,255) -- renkleri kaydettik b.irenk = icRenk or tocolor(175,49,0,255) -- renkleri kaydettik b.brenk = barRenk or tocolor(0,200,0,255) -- renkleri kaydettik b.ilerleme = 0 -- bar ilerleme 0 kaydettik b.postGui = gui or false -- postgui ayarını şey ettik b.bitis = getTickCount()+ms -- bitiş ayarladık return sayiendfunction destroyProgressBar(barid) for i,v in pairs(barlar) do -- barları döndür if barid == i then -- eğer barid varsa table.remove(barlar,i) -- tablodan çıkar return true end end return falseend function getBarProgress(barid) if not barlar[barid] then return false end return barlar[barid].ilerlemeendfunction render() if #barlar == 0 then removeEventHandler("onClientRender",root,render) end local baslangic = getTickCount() for i,v in pairs(barlar) do -- tüm barları döndürdük if v.bitis > baslangic then local buzunluk = v.g-10 local prog = (v.sure-(v.bitis-baslangic))/v.sure local ilerleme = (buzunluk)*prog dxDrawRectangle(v.x,v.y,v.g,v.u,v.arenk,v.postGui) -- en arka dxDrawRectangle(v.x+5,v.y+5,v.g-10,v.u-10,v.irenk,v.postGui) -- ic katman dxDrawRectangle(v.x+5,v.y+5,ilerleme,v.u-10,v.brenk,v.postGui) -- dolucak bar local progress = math.floor(prog*100) barlar[i].ilerleme = progress local puzun = dxGetTextWidth(progress,1,"clear") dxDrawText(progress.."%",(v.x+(v.g)/2)-puzun,(v.y+(v.u)/2)-8,v.g,v.u,tocolor(255,255,255,255),1,"clear",nil,nil,nil,nil,v.postGui) else table.remove(barlar,i) end endend
local sx,sy = guiGetScreenSize()local pg,pu = 200,25local x,y = (sx-pg)/2,(sy-pu)/2local bar = createProgressBar(x,y,pg,pu,10000,tocolor(0,0,0,255),tocolor(175,49,0,255),tocolor(0,200,0,255),true)setTimer(outputChatBox,10000,1,bar.." #FFFFFFId'li bar doldu",255,0,0,true)setTimer(function() local i = getBarProgress(bar) print(i)end,5000,1)
--serverfunction createProgressBar(oyuncu) triggerClientEvent(oyuncu,"PB:createProgressBar",oyuncu)endaddCommandHandler("bar",function(oyuncu) createProgressBar(oyuncu)end)
--clientlocal sx,sy = guiGetScreenSize()local pg,pu = 200,25local x,y = (sx-pg)/2,(sy-pu)/2addEvent("PB:createProgressBar",true)addEventHandler("PB:createProgressBar", root, function() local bar = createProgressBar(x,y,pg,pu,10000,tocolor(0,0,0,255),tocolor(175,49,0,255),tocolor(0,200,0,255),true) setTimer(outputChatBox,10000,1,bar.." #FFFFFFId'li bar doldu",255,0,0,true)end)