daggy_ofc Posted November 17, 2020 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)
Moderators Tut Posted November 17, 2020 Moderators Posted November 17, 2020 Lengthy thread title has been shortened. Please avoid too many capital letters! Give a man a fish and you feed him for a day. Teach him how to fish and you feed him for a lifetime - Lao Tzu
Moderators IIYAMA Posted November 17, 2020 Moderators Posted November 17, 2020 Moved to here: https://forum.multitheftauto.com/forum/127-programação-em-lua/ Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Boechat Posted November 18, 2020 Posted November 18, 2020 dxDrawProgressBar Te ajudei? Me ajude também deixando seu Thanks! Discord: _muelzera_
daggy_ofc Posted November 18, 2020 Author Posted November 18, 2020 4 hours ago, Boechat said: dxDrawProgressBar TIPO A FUNÇÃO EU SEI SÓ NÃO SEI COLOCAR DENTRO DO SCRIPT
Boechat Posted November 23, 2020 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. Te ajudei? Me ajude também deixando seu Thanks! Discord: _muelzera_
Boechat Posted November 23, 2020 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 Te ajudei? Me ajude também deixando seu Thanks! Discord: _muelzera_
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