Tando Posted February 13, 2019 Share Posted February 13, 2019 function loadd() dxDrawLine(471 - 1, 358 - 1, 471 - 1, 411, tocolor(254, 254, 254, 254), 1, false) dxDrawLine(895, 358 - 1, 471 - 1, 358 - 1, tocolor(254, 254, 254, 254), 1, false) dxDrawLine(471 - 1, 411, 895, 411, tocolor(254, 254, 254, 254), 1, false) dxDrawLine(895, 411, 895, 358 - 1, tocolor(254, 254, 254, 254), 1, false) dxDrawRectangle(471, 358, 424, 53, tocolor(0, 0, 0, 182), false) --------- DX dxDrawRectangle(476, 360, 415, 47, tocolor(5, 76, 183, 144), false) --------progressbar=100 dxDrawRectangle(476, 360, 5, 47, tocolor(5, 76, 183, 144), false)-----progressbar=0 dxDrawText("WEARING ARMOUR (0%)", 486, 368, 871, 411, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false) end addEventHandler("onClientRender", root, loadd) local unlerp = function(from,to,lerp) return (lerp-from)/(to-from) end function dxDrawProgressBar( startX, startY, width, height, progress, color, backColor ) local progress = math.max( 0, (math.min( 100, progress) ) ) local wBar = width*.18 for i = 0, 4 do --back local startPos = (wBar*i + (width*.025)*i) + startX dxDrawRectangle( startPos, startY, wBar, height, backColor ) --progress local eInterval = (i*20) local localProgress = math.min( 1, unlerp( eInterval, eInterval + 20, progress ) ) if localProgress > 0 then dxDrawRectangle( startPos, startY, wBar*localProgress, height, color ) end end end i need when i use armour it's shown Progress count from 0 to 100 setTimer(addArmour, 5000, 1) Link to comment
WorthlessCynomys Posted February 13, 2019 Share Posted February 13, 2019 You can use .. to use variables in strings. Just like this: outputChatBox("You have "..getPedArmor(localPlayer).."% armour") and you can calculate the length of a dxRectangle with this formula: maxLength*(currentValue/maxValue) At armour it looks like this: maxLength*(getPedArmor(localPlayer)/100) Whereas getPedArmor is your current value, of how much armor a player has, and 100 is the max, since a full armor has a value of 100. The length can be decided by you. Link to comment
Tando Posted February 13, 2019 Author Share Posted February 13, 2019 2 hours ago, WorthlessCynomys said: You can use .. to use variables in strings. Just like this: outputChatBox("You have "..getPedArmor(localPlayer).."% armour") and you can calculate the length of a dxRectangle with this formula: maxLength*(currentValue/maxValue) At armour it looks like this: maxLength*(getPedArmor(localPlayer)/100) Whereas getPedArmor is your current value, of how much armor a player has, and 100 is the max, since a full armor has a value of 100. The length can be decided by you. I didn't understand u Can u explain to me, Please ? Link to comment
mazarati21 Posted February 13, 2019 Share Posted February 13, 2019 Something like this to get the player health. local armor = math.ceil(getPedArmor(localPlayer)) Link to comment
Tando Posted February 14, 2019 Author Share Posted February 14, 2019 11 hours ago, mazarati21 said: Something like this to get the player health. local armor = math.ceil(getPedArmor(localPlayer)) getting armour working fine and everything but i want add when player open inventory to use armour when he start use it this Gui shown for player WEARING ARMOUR (0 To 100%) Link to comment
mazarati21 Posted February 15, 2019 Share Posted February 15, 2019 You can use this. https://wiki.multitheftauto.com/wiki/DxDrawRectangle then dxDrawText("Armor: "..armor.."%" etc.. Link to comment
Tando Posted February 16, 2019 Author Share Posted February 16, 2019 15 hours ago, mazarati21 said: You can use this. https://wiki.multitheftauto.com/wiki/DxDrawRectangle then dxDrawText("Armor: "..armor.."%" etc.. Thanks u alot i have finished it 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