Gab MTA Posted June 17, 2021 Share Posted June 17, 2021 (edited) Bem estou treinando bastante painel-dx na programação lua, mas eu preciso de ajuda em 1 coisa, eu queria saber qual a função de dar e destruir o veiculo, igual ao painel P. Outra coisa que está dando erro é a função de dar arma, no botão que da skin e arma, a skin vem, mas não da a arma. Quem poder estar me ajudando ai agradeço script: local screenW, screenH = guiGetScreenSize() local Exibir_Painel = false function PainelDX () dxDrawRectangle(screenW * 0.2258, screenH * 0.2474, screenW * 0.5344, screenH * 0.5182, tocolor(0, 0, 0, 138), false) dxDrawText("PAINEL - CORP", screenW * 0.4383, screenH * 0.2604, screenW * 0.5461, screenH * 0.2995, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawImage(screenW * 0.2258, screenH * 0.2474, screenW * 0.0953, screenH * 0.1458, ":painel-dx/files/Logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("COPYRIGHT © Brasil Mundo Leve - 2021", screenW * 0.4047, screenH * 0.7656, screenW * 0.5813, screenH * 0.7852, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawImage(screenW * 0.2820, screenH * 0.3984, screenW * 0.0773, screenH * 0.1458, ":painel-dx/files/img/police.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(screenW * 0.4133, screenH * 0.4375, screenW * 0.1547, screenH * 0.1068, ":painel-dx/files/img/vtr.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(screenW * 0.6250, screenH * 0.4583, screenW * 0.1219, screenH * 0.0859, ":painel-dx/files/img/heli.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.2773, screenH * 0.5482, screenW * 0.0945, screenH * 0.0404, tocolor(254, 107, 0, 254), false) dxDrawText("Farda 1", screenW * 0.2773, screenH * 0.5482, screenW * 0.3719, screenH * 0.5885, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.2773, screenH * 0.6016, screenW * 0.0945, screenH * 0.0404, tocolor(254, 107, 0, 254), false) dxDrawText("Farda 2", screenW * 0.2773, screenH * 0.6016, screenW * 0.3719, screenH * 0.6419, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.2773, screenH * 0.6549, screenW * 0.0945, screenH * 0.0404, tocolor(254, 107, 0, 254), false) dxDrawText("Farda 3", screenW * 0.2773, screenH * 0.6549, screenW * 0.3719, screenH * 0.6953, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.2773, screenH * 0.7083, screenW * 0.0945, screenH * 0.0404, tocolor(254, 107, 0, 254), false) dxDrawText("Farda 4", screenW * 0.2773, screenH * 0.7083, screenW * 0.3719, screenH * 0.7487, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.4430, screenH * 0.5482, screenW * 0.0945, screenH * 0.0404, tocolor(254, 107, 0, 254), false) dxDrawText("Viatura 1", screenW * 0.4430, screenH * 0.5482, screenW * 0.5375, screenH * 0.5885, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.4430, screenH * 0.6016, screenW * 0.0945, screenH * 0.0404, tocolor(254, 107, 0, 254), false) dxDrawText("Viatura 2", screenW * 0.4430, screenH * 0.6016, screenW * 0.5375, screenH * 0.6419, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.4430, screenH * 0.6549, screenW * 0.0945, screenH * 0.0404, tocolor(254, 107, 0, 254), false) dxDrawText("Viatura 3", screenW * 0.4430, screenH * 0.6549, screenW * 0.5375, screenH * 0.6953, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.6398, screenH * 0.5482, screenW * 0.0945, screenH * 0.0404, tocolor(254, 107, 0, 254), false) dxDrawText("Helicoptero", screenW * 0.6398, screenH * 0.5482, screenW * 0.7344, screenH * 0.5885, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.4430, screenH * 0.7083, screenW * 0.0945, screenH * 0.0404, tocolor(254, 107, 0, 254), false) dxDrawText("Guardar Viatura", screenW * 0.4430, screenH * 0.7083, screenW * 0.5375, screenH * 0.7487, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.6398, screenH * 0.6016, screenW * 0.0945, screenH * 0.0404, tocolor(254, 107, 0, 254), false) dxDrawText("Guardar Helicoptero", screenW * 0.6398, screenH * 0.6016, screenW * 0.7344, screenH * 0.6419, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.6398, screenH * 0.2656, screenW * 0.1070, screenH * 0.0729, tocolor(244, 92, 0, 254), false) dxDrawText("ARMAS", screenW * 0.6406, screenH * 0.2656, screenW * 0.7469, screenH * 0.3385, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawRectangle(763, 534, 200, 44, tocolor(244, 92, 0, 254), false) dxDrawText("APAISANA", screenW * 0.5961, screenH * 0.6953, screenW * 0.7523, screenH * 0.7487, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) end addCommandHandler("treino", function() if Exibir_Painel == false then addEventHandler("onClientRender", getRootElement(), PainelDX) Exibir_Painel = true showCursor(true) else removeEventHandler("onClientRender", getRootElement(), PainelDX) Exibir_Painel = false showCursor(false) end end) function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) ) end -- Modified version for DX Text function isCursorOverText(posX, posY, sizeX, sizeY) if ( not isCursorShowing( ) ) then return false end local cX, cY = getCursorPosition() local screenWidth, screenHeight = guiGetScreenSize() local cX, cY = (cX*screenWidth), (cY*screenHeight) return ( (cX >= posX and cX <= posX+(sizeX - posX)) and (cY >= posY and cY <= posY+(sizeY - posY)) ) end addEventHandler("onClientClick", getRootElement(), function(button, state) if button=="left" and state=="down" then if Exibir_Painel == true then if isMouseInPosition(screenW * 0.2773, screenH * 0.5482, screenW * 0.0945, screenH * 0.0404) then outputChatBox("#FFA500[BML - INFO] #FFFFFF Você pegou a Farda 1 com sucesso!", 255, 255, 255, true) setElementModel(localPlayer, 73) end end end end) addEventHandler("onClientClick", getRootElement(), function(button, state) if button=="left" and state=="down" then if Exibir_Painel == true then if isMouseInPosition(screenW * 0.2773, screenH * 0.6016, screenW * 0.0945, screenH * 0.0404) then outputChatBox("#FFA500[BML - ERRO]#FFFFFF Você não possue essa Farda!", 255, 255, 255, true) end end end end) addEventHandler("onClientClick", getRootElement(), function(button, state) if button=="left" and state=="down" then if Exibir_Painel == true then if isMouseInPosition(screenW * 0.2773, screenH * 0.6549, screenW * 0.0945, screenH * 0.0404) then outputChatBox("#FFA500[BML - ERRO]#FFFFFF Você não possue essa Farda!", 255, 255, 255, true) end end end end) addEventHandler("onClientClick", getRootElement(), function(button, state) if button=="left" and state=="down" then if Exibir_Painel == true then if isMouseInPosition(screenW * 0.2773, screenH * 0.7083, screenW * 0.0945, screenH * 0.0404) then outputChatBox("#FFA500[BML - ERRO]#FFFFFF Você não possue essa Farda!", 255, 255, 255, true) end end end end) addEventHandler("onClientClick", getRootElement(), function(button, state) if button=="left" and state=="down" then if Exibir_Painel == true then if isMouseInPosition(screenW * 0.4430, screenH * 0.5482, screenW * 0.0945, screenH * 0.0404) then local x,y,z = getElementPosition(localPlayer) veh = createVehicle(596, x,y,z) outputChatBox("#FFA500[BML - INFO] #FFFFFFVocê pegou a Viatura 1 com sucesso!", 255, 255, 255, true) (função de dar o veiculo aqui) end end end end) addEventHandler("onClientClick", getRootElement(), function(button, state) if button=="left" and state=="down" then if Exibir_Painel == true then if isMouseInPosition(screenW * 0.4430, screenH * 0.6016, screenW * 0.0945, screenH * 0.0404) then outputChatBox("#FFA500[BML - ERRO]#FFFFFFVocê não possue essa Viatura!", 255, 255, 255, true) end end end end) addEventHandler("onClientClick", getRootElement(), function(button, state) if button=="left" and state=="down" then if Exibir_Painel == true then if isMouseInPosition(screenW * 0.4430, screenH * 0.6549, screenW * 0.0945, screenH * 0.0404) then outputChatBox("#FFA500[BML - ERRO]#FFFFFFVocê não possue essa Viatura!", 255, 255, 255, true) end end end end) addEventHandler("onClientClick", getRootElement(), function(button, state) if button=="left" and state=="down" then if Exibir_Painel == true then if isMouseInPosition(screenW * 0.6398, screenH * 0.5482, screenW * 0.0945, screenH * 0.0404) then outputChatBox("#FFA500[BML - INFO] #FFFFFFVocê pegou o Helicoptero com sucesso!", 255, 255, 255, true) (função de dar o veiculo aqui) end end end end) addEventHandler("onClientClick", getRootElement(), function(button, state) if button=="left" and state=="down" then if Exibir_Painel == true then if isMouseInPosition(screenW * 0.4430, screenH * 0.7083, screenW * 0.0945, screenH * 0.0404) then outputChatBox("#FFA500[BML - INFO] #FFFFFFVocê guardou a Viatura com sucesso!", 255, 255, 255, true) (função de destruir i veiculo aqui) end end end end) addEventHandler("onClientClick", getRootElement(), function(button, state) if button=="left" and state=="down" then if Exibir_Painel == true then if isMouseInPosition(screenW * 0.6398, screenH * 0.6016, screenW * 0.0945, screenH * 0.0404) then outputChatBox("#FFA500[BML - INFO] #FFFFFFVocê guardou o Helicoptero com sucesso!", 255, 255, 255, true) (função de destruir o veiculo aqui) end end end end) addEventHandler("onClientClick", getRootElement(), function(button, state) if button=="left" and state=="down" then if Exibir_Painel == true then if isMouseInPosition(screenW * 0.6398, screenH * 0.2656, screenW * 0.1070, screenH * 0.0729) then outputChatBox("#FFA500[BML - INFO] #FFFFFFVocê pegou as Armas com sucesso", 255, 255, 255, true) giveWeapon ( source, 1, 1 ) giveWeapon ( source, 3, 1 ) giveWeapon ( source, 23, 9999 ) giveWeapon ( source, 25, 9999 ) giveWeapon ( source, 29, 9999 ) giveWeapon ( source, 31, 9999 ) giveWeapon ( source, 16, 9999 ) giveWeapon ( source, 44, 1 ) setPedArmor ( source, 100 ) setElementHealth ( source, 100 ) end end end end) addEventHandler("onClientClick", getRootElement(), function(button, state) if button=="left" and state=="down" then if Exibir_Painel == true then if isMouseInPosition(screenW * 0.5961, screenH * 0.6953, screenW * 0.7523, screenH * 0.7487) then outputChatBox("#FFA500[BML - INFO] #FFFFFFVocê pegou o Pack Apaisana com sucesso", 255, 255, 255, true) setElementModel(localPlayer, 0) giveWeapon ( source, 1, 1 ) giveWeapon ( source, 24, 9999 ) setPedArmor ( source, 100 ) setElementHealth ( source, 100 ) end end end end) OBS: se vc for editar meu script, os lugares para colocar as funções estão entre parenteses, mas se for mandar o nome da função tambem ajuda dms Edited June 17, 2021 by Gab MTA Link to comment
Joaovit13 Posted June 17, 2021 Share Posted June 17, 2021 Olá, tudo bem? Bom amigo existe uma função aqui no fórum aonde você consegue colocar o script para ficar mais legível. https://prnt.sc/15qpv29 Já na função de criar o carro seria essa: createVehicle E a função de destruir o veiculo seria essa: destroyElement Tenha uma boa sorte 1 Link to comment
Gab MTA Posted June 17, 2021 Author Share Posted June 17, 2021 man obg, mas c sabe a função de dar arma 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