Ciastuuś Posted April 25, 2019 Share Posted April 25, 2019 Hi, I have a question. How to rotate in a different direction? Because it looks like this: Server: Code: local x,y = guiGetScreenSize() local show = true function dxDrawCircle( posX, posY, radius, width, angleAmount, startAngle, stopAngle, color, postGUI ) if ( type( posX ) ~= "number" ) or ( type( posY ) ~= "number" ) then return false end 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 = type( radius ) == "number" and radius or 50 width = type( width ) == "number" and width or 5 angleAmount = type( angleAmount ) == "number" and angleAmount or 0 startAngle = clamp( type( startAngle ) == "number" and startAngle or 0, 0, 360 ) stopAngle = clamp( type( stopAngle ) == "number" and stopAngle or 360, 0, 360 ) color = color or tocolor( 25, 25, 25, 0 ) postGUI = type( postGUI ) == "boolean" and postGUI or false if ( stopAngle < startAngle ) then local tempAngle = stopAngle stopAngle = startAngle startAngle = tempAngle end for i = startAngle, stopAngle, angleAmount do local startX = math.cos( math.rad( i ) ) * ( radius - width ) local startY = math.sin( math.rad( i ) ) * ( radius - width ) local endX = math.cos( math.rad( i ) ) * ( radius + width ) local endY = math.sin( math.rad( i ) ) * ( radius + width ) dxDrawLine( startX + posX, startY + posY, endX + posX, endY + posY, color, width, postGUI ) end return true end local health = tonumber(getElementHealth(localPlayer)) or 0 local armor = tonumber(getPedArmor(localPlayer)) or 0 local hunger = getElementData(localPlayer, "gracz:glod") local thirsty = getElementData(localPlayer, "gracz:spragnienie") function drawCircleHud() if (show==true) then dxDrawCircle(x-250, 35, 0.1, 22.1, 1, 0, 360, tocolor(25, 25, 25)) dxDrawCircle(x-250, 35, 24, 2, 1, 0, health*3.6, tocolor(255, 50, 50)) dxDrawImage(1657, 24, 24, 24, "grafika/zycie.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawCircle(x-180, 35, 0.1, 22.1, 1, 0, 360, tocolor(25, 25, 25)) dxDrawCircle(x-180, 35, 24, 2, 1, 0, armor*3.6, tocolor(66, 134, 244)) dxDrawImage(1728, 24, 24, 24, "grafika/kamizelka.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawCircle(x-110, 35, 0.1, 22.1, 1, 0, 360, tocolor(25, 25, 25)) dxDrawCircle(x-110, 35, 24, 2, 1, 0, hunger*3.6, tocolor(158, 97, 29)) dxDrawImage(1800, 24, 24, 24, "grafika/glod.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawCircle(x-40, 35, 0.1, 22.1, 1, 0, 360, tocolor(25, 25, 25)) dxDrawCircle(x-40, 35, 24, 2, 1, 0, thirsty*3.6, tocolor(14, 173, 175)) dxDrawImage(1869, 24, 24, 24, "grafika/spragnienie.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end end addEventHandler("onClientRender", root, drawCircleHud) local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" } addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end) 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