daggy_ofc Posted November 17, 2020 Share Posted November 17, 2020 local marker = createMarker (1464.9125976563,-1733.6157226563,13.0000000, "cylinder", 1, 0, 255, 255, 255) function dinheiro(jogador) if jogador and isElement(jogador) and getElementType(jogador) == "player" and isElementWithinMarker(jogador, marker) then setPedAnimation(jogador, 'bomber', 'BOM_Plant_Loop', 5 * 1000, true, false, false, false) givePlayerMoney(jogador, 2000) end end addCommandHandler("saquear", dinheiro) Link to comment
Administrators Tut Posted November 17, 2020 Administrators Share Posted November 17, 2020 Lengthy thread title has been shortened. Please avoid too many capital letters! Link to comment
Moderators IIYAMA Posted November 17, 2020 Moderators Share Posted November 17, 2020 Moved to here: https://forum.multitheftauto.com/forum/127-programação-em-lua/ Link to comment
daggy_ofc Posted November 18, 2020 Author Share Posted November 18, 2020 4 hours ago, Boechat said: dxDrawProgressBar TIPO A FUNÇÃO EU SEI SÓ NÃO SEI COLOCAR DENTRO DO SCRIPT Link to comment
Boechat Posted November 23, 2020 Share Posted November 23, 2020 On 18/11/2020 at 09:52, daggy_ofc said: TIPO A FUNÇÃO EU SEI SÓ NÃO SEI COLOCAR DENTRO DO SCRIPT Clica aí e da uma olha na pagina da wiki, lá tem esse exemplo de uso: function draw() dxDrawProgressBar( 10, 10, 200, 200, math.random(0,100), tocolor( 250, 50, 50, 255), tocolor( 255, 255, 255, 255) ) end addEventHandler("onClientRender", root, draw) -- Keep everything visible with onClientRender. Link to comment
Boechat Posted November 23, 2020 Share Posted November 23, 2020 (edited) 45 minutes ago, Boechat said: Clica aí e da uma olha na pagina da wiki, lá tem esse exemplo de uso: function draw() dxDrawProgressBar( 10, 10, 200, 200, math.random(0,100), tocolor( 250, 50, 50, 255), tocolor( 255, 255, 255, 255) ) end addEventHandler("onClientRender", root, draw) -- Keep everything visible with onClientRender. Lembrando que tem que ter a função no mesmo código (nessa função você não mexe em nada, só no exemplo acima você edita) 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 Na página da wiki explica como usar cada argumento da função, dá uma lida la e traz suas dúvidas pra gente poder resolver. Edited November 23, 2020 by Boechat 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