PartyMTA Posted June 16, 2014 Share Posted June 16, 2014 Hi, i made this code with some thing out of the useful functions section. It will generate when it's completely white. So it will repeat making the spotlight. Used dxDrawPartialCircle and dxDrawCircle Dont ask me why i called the function dxDrawLoadBar.. function dxDrawLoadBar(posX, posY, radius, width, startAngle, endAngle, angleAmount, color, postGUI) local function clamp(val, lower, upper) if (lower > upper) then lower, upper = upper, lower end return math.max(lower, math.min(upper, val)) end radius = radius or -50 width = width or 5 startAngle = clamp(startAngle or 0, 0, 360) endAngle = clamp(endAngle or 360, 0, 360) angleAmount = angleAmount or 1 color = color or tocolor(255, 255, 255, 10) or tocolor(0, 0,0, 200) postGUI = postGUI or false for i=startAngle,endAngle,angleAmount do local _i = i*((math.pi/180-(posX/posY*40)-posX)*40) dxDrawLine(math.cos(_i)*(radius-width)+posX, math.sin(_i)*(radius-width)+(posY+60/posX),-posX*10,-posY/5, color, 6, postGUI) end return true end function dxDrawCircle(posX, posY, radius, width, angleAmount, color, postGUI) radius = radius or 50 width = width or 5 angleAmount = angleAmount or 1 color = color or tocolor(0, 150, 50, 50) postGUI = postGUI or false for i=0,360,angleAmount do local _i = i*(math.pi/180) dxDrawLine(math.cos(_i)*(radius-width)+posX, math.sin(_i)*(radius-width)+posY, math.cos(_i)*(radius+width)+posX, math.sin(_i)*(radius+width)+posY, color, width, postGUI) end return true end addEventHandler("onClientResourceStart", resourceRoot, function() sx, sy = guiGetScreenSize() addEventHandler("onClientRender", root, function() dxDrawCircle(sx/1.1, sy/1.1) dxDrawCircle(sx/1.1, sy/1.1,40,_,_,tocolor(0,150,150,50)) dxDrawCircle(sx/1.1, sy/1.1,30) dxDrawCircle(sx/1.1, sy/1.1,20,_,_,tocolor(0,150,150,50)) dxDrawCircle(sx/1.1, sy/1.1,10) dxDrawCircle(sx/1.1, sy/1.1,0,_,_,tocolor(0,150,150,50)) dxDrawCircle(sx/1.1,sy/1.1,60,_,_,tocolor(0,150,150,50)) dxDrawCircle(sx/1.1,sy/1.1,61,_,_,tocolor(0,150,150,40)) dxDrawCircle(sx/1.1,sy/1.1,62,_,_,tocolor(0,150,150,30)) dxDrawCircle(sx/1.1,sy/1.1,63,_,_,tocolor(0,150,150,20)) dxDrawCircle(sx/1.1,sy/1.1,64,_,_,tocolor(0,150,150,10)) dxDrawCircle(sx/1.1,sy/1.1,65,_,_,tocolor(0,150,150,1)) end ) end ) addEventHandler("onClientResourceStart", resourceRoot, function() sx, sy = guiGetScreenSize() percentage = 0 addEventHandler("onClientRender", root, function() if (percentage < 360) then percentage = percentage+5 else percentage = 0 end dxDrawLoadBar(sx/1.1, sy/1.1, nil, nil, 0, percentage) end ) end ) Just run it clientsided. You can play with local _i = i*((math.pi/180-(posX/posY*40)-posX)*40) Screen: Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now