Kraus MTA Posted May 19, 2019 Posted May 19, 2019 (edited) Estou fazendo um painel de armas via painel, e desejo fazer o painel abrir o marcador, alguem poderia me ajudar? Tenho DX pronta, permitindo um vídeo do tutorial sei lá qualquer coisa assim Contato ʙᴏʟᴛ # 4403 Edited May 19, 2019 by Kraus MTA
Jonas^ Posted May 19, 2019 Posted May 19, 2019 (edited) Você postou na sessão errada. --- Você ira precisar de: https://wiki.multitheftauto.com/wiki/OnMarkerHit -- Quando colidir no marker vai chamar o trigger do onclientrender que ira mostrar o painel. https://wiki.multitheftauto.com/wiki/OnClientRender -- Evento que ira renderizar o painel. https://wiki.multitheftauto.com/wiki/TriggerServerEvent Trigger client > server pra dar a arma ao jogador e retirar dinheiro. https://wiki.multitheftauto.com/wiki/TriggerClientEvent -- Quando colidir no marker entra em conexão server > cliente pra receber o render do painel. Edited May 19, 2019 by Jonas^
Kraus MTA Posted May 19, 2019 Author Posted May 19, 2019 Desculpe pela sessão, mas gratificado pela ajuda.
Kraus MTA Posted May 20, 2019 Author Posted May 20, 2019 @Jonas^ pode me informar uma coisa que nao entendi mto bem nesse meio de links que vc enviou queria saber como ativar o cursor pra quando abrir o painel eu clicar no botão de tal arma e dar o takePlayerMoney e o GiveWeapon cara nao consegui entender direito pois a tradução automatica do google nesses links fica pessima. muda mtos significados
Jonas^ Posted May 20, 2019 Posted May 20, 2019 (edited) https://wiki.multitheftauto.com/wiki/ShowCursor @Kraus MTA Se tiver com dúvidas ainda, poste o código aqui que posso te auxiliar. -- Eu aconselho você usar GUI pra essas situações mais simples, além de ser mais fácil de mexer, pelo que percebi você é novo na programação no MTA. Edited May 20, 2019 by Jonas^
Kraus MTA Posted May 20, 2019 Author Posted May 20, 2019 (edited) Sou novo nessa parte sim, sou mais mapper e texturizador. Então Não foi kk sou pessimo Mas estou aprendendo Client: local PanelGun = createMarker(1503.3000488281, -666.59997558594, 95.599998474121, 'cylinder', 1.5, 255, 255, 0, 170 ) function PanelGun( hitElement, matchingDimension ) -- define MarkerHit function for the handler local elementType = getElementType( hitElement ) -- get the hit element's type outputChatBox ( "#FF0000[BCR]#FFFFFF Compre Sua Arma", getRootElement(), 255, 0, 0, true )endaddEventHandler( "onMarkerHit", PanelGun, PanelGun ) -- attach onMarkerHit event to MarkerHit function function dxGuiaddEventHandler("onClientRender", root, function() dxDrawLine(494 - 1, 98 - 1, 494 - 1, 552, tocolor(254, 254, 254, 108), 1, false) dxDrawLine(877, 98 - 1, 494 - 1, 98 - 1, tocolor(254, 254, 254, 108), 1, false) dxDrawLine(494 - 1, 552, 877, 552, tocolor(254, 254, 254, 108), 1, false) dxDrawLine(877, 552, 877, 98 - 1, tocolor(254, 254, 254, 108), 1, false) dxDrawRectangle(494, 98, 383, 454, tocolor(0, 0, 0, 149), false) dxDrawRectangle(494, 98, 383, 60, tocolor(255, 255, 255, 255), false) dxDrawText("Máfia Armas", 560, 108, 892, 148, tocolor(0, 0, 0, 254), 1.10, "bankgothic", "left", "top", false, false, false, false, false) dxDrawLine(508 - 1, 173 - 1, 508 - 1, 252, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(861, 173 - 1, 508 - 1, 173 - 1, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(508 - 1, 252, 861, 252, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(861, 252, 861, 173 - 1, tocolor(249, 249, 249, 122), 1, false) dxDrawRectangle(508, 173, 353, 79, tocolor(0, 0, 0, 254), false) dxDrawText("Pistola 9MM - 2500R$", 518, 193, 817, 222, tocolor(255, 255, 255, 255), 0.90, "bankgothic", "left", "top", false, false, false, false, false) dxDrawLine(508 - 1, 290 - 1, 508 - 1, 369, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(861, 290 - 1, 508 - 1, 290 - 1, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(508 - 1, 369, 861, 369, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(861, 369, 861, 290 - 1, tocolor(249, 249, 249, 122), 1, false) dxDrawRectangle(508, 290, 353, 79, tocolor(0, 0, 0, 254), false) dxDrawText("AK47 S/Coronha- 5000R$", 513, 317, 812, 346, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "left", "top", false, false, false, false, false) dxDrawLine(508 - 1, 406 - 1, 508 - 1, 485, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(861, 406 - 1, 508 - 1, 406 - 1, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(508 - 1, 485, 861, 485, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(861, 485, 861, 406 - 1, tocolor(249, 249, 249, 122), 1, false) dxDrawRectangle(508, 406, 353, 79, tocolor(0, 0, 0, 254), false) dxDrawText("AK47 c/Coronha- 15000R$", 513, 429, 812, 458, tocolor(255, 255, 255, 255), 0.77, "bankgothic", "left", "top", false, false, false, false, false) end) function armas (_,state)if painel == true thenif state == "down" thenif isCursorOnElement(560, 108, 892, 148 ) thentriggerServerEvent ("arma1", localPlayer)endendendendaddEventHandler ("onClientClick", root, armas) ---------------------------- Serverfunction arma1 () giveWeapon( source, 22, 999, true ) outputChatBox ('( #00ff00BCR#ffffff )#ffff00Voce Pegou a #00ff00Pistola !',source,255,255,255,true)endaddEvent("arma1",true)addEventHandler ( "arma1", getRootElement(), arma1 )----------------------------------------------- Ainda não adicionei o takePlayerMoney estou apenas testando para ver se a arma vem no caso não ta nem existindo o marker de tão perdido que estou... Alem de tudo ainda quero adicionar uma opção de acl pra Máfia mas nesse caso não é 100% necessario outra coisa se souber algum curso bom de .lua do youtube em portugues se conseguir me passar tambem ajudaria muito! Edited May 20, 2019 by Kraus MTA
Jonas^ Posted May 20, 2019 Posted May 20, 2019 (edited) client-side: local x, y = guiGetScreenSize () local painel = false function renderPanel () dxDrawLine(494 - 1, 98 - 1, 494 - 1, 552, tocolor(254, 254, 254, 108), 1, false) dxDrawLine(877, 98 - 1, 494 - 1, 98 - 1, tocolor(254, 254, 254, 108), 1, false) dxDrawLine(494 - 1, 552, 877, 552, tocolor(254, 254, 254, 108), 1, false) dxDrawLine(877, 552, 877, 98 - 1, tocolor(254, 254, 254, 108), 1, false) dxDrawRectangle(494, 98, 383, 454, tocolor(0, 0, 0, 149), false) dxDrawRectangle(494, 98, 383, 60, tocolor(255, 255, 255, 255), false) dxDrawText("Máfia Armas", 560, 108, 892, 148, tocolor(0, 0, 0, 254), 1.10, "bankgothic", "left", "top", false, false, false, false, false) dxDrawLine(508 - 1, 173 - 1, 508 - 1, 252, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(861, 173 - 1, 508 - 1, 173 - 1, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(508 - 1, 252, 861, 252, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(861, 252, 861, 173 - 1, tocolor(249, 249, 249, 122), 1, false) dxDrawRectangle(508, 173, 353, 79, tocolor(0, 0, 0, 254), false) dxDrawText("Pistola 9MM - 2500R$", 518, 193, 817, 222, tocolor(255, 255, 255, 255), 0.90, "bankgothic", "left", "top", false, false, false, false, false) dxDrawLine(508 - 1, 290 - 1, 508 - 1, 369, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(861, 290 - 1, 508 - 1, 290 - 1, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(508 - 1, 369, 861, 369, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(861, 369, 861, 290 - 1, tocolor(249, 249, 249, 122), 1, false) dxDrawRectangle(508, 290, 353, 79, tocolor(0, 0, 0, 254), false) dxDrawText("AK47 S/Coronha- 5000R$", 513, 317, 812, 346, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "left", "top", false, false, false, false, false) dxDrawLine(508 - 1, 406 - 1, 508 - 1, 485, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(861, 406 - 1, 508 - 1, 406 - 1, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(508 - 1, 485, 861, 485, tocolor(249, 249, 249, 122), 1, false) dxDrawLine(861, 485, 861, 406 - 1, tocolor(249, 249, 249, 122), 1, false) dxDrawRectangle(508, 406, 353, 79, tocolor(0, 0, 0, 254), false) dxDrawText("AK47 c/Coronha- 15000R$", 513, 429, 812, 458, tocolor(255, 255, 255, 255), 0.77, "bankgothic", "left", "top", false, false, false, false, false) end function startRender () if painel == false then addEventHandler ("onClientRender", root, renderPanel) showCursor (true) painel = true end end addEvent ("onRequestOpenPanel", true) addEventHandler ("onRequestOpenPanel", getRootElement(), startRender) function armas (_, state) if painel == true then if state == "down" then if isCursorOnElement (560, 108, 892, 148) then triggerServerEvent ("arma1", localPlayer) end end end end addEventHandler ("onClientClick", root, armas) function isCursorOnElement (x, y, w, h) local mx, my = getCursorPosition () local fullx, fully = guiGetScreenSize () cursorx,cursory = mx * fullx, my * fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end server-side: local PanelGun = createMarker (1503.3, -666.5, 95.5, 'cylinder', 1.5, 255, 255, 0, 170) addEventHandler ("onMarkerHit", PanelGun, function (hitElement, matchingDimension) outputChatBox ("#FF0000[BCR]#FFFFFF Compre Sua Arma", hitElement, 255, 0, 0, true) triggerClientEvent (hitElement, "onRequestOpenPanel", hitElement) end) function arma1 () giveWeapon (source, 22, 999, true) outputChatBox ("#00ff00BCR#ffffff )#ffff00Voce Pegou a #00ff00Pistola !", source, 255, 255, 255, true) end addEvent ("arma1", true) addEventHandler ("arma1", getRootElement(), arma1) -- Aconselho fazer em GUI Edited May 20, 2019 by Jonas^ 1
Kraus MTA Posted May 20, 2019 Author Posted May 20, 2019 (edited) consegui dar uma entendida mas ainda não abre o dx .-. kkk to tentado o erro aqui pelo menos agr o marker ta indo mas vlw ai ja deu uma boa ajuda !! Edited May 20, 2019 by Kraus MTA
Jonas^ Posted May 20, 2019 Posted May 20, 2019 Sem sentido não abrir, você conseguiu estragar oque estava funcionando, eu testei aqui e abriu. 1
Kraus MTA Posted May 20, 2019 Author Posted May 20, 2019 (edited) .-. como se nem editei nd que vc fez kk, so se for o server, consegui aqui men vlww broww Edited May 20, 2019 by Kraus MTA
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