Vazern Posted March 14, 2018 Share Posted March 14, 2018 Olá pessoal! Estou tendo um pequeno problema, sou iniciante em scripting e estava usando o recurso Object_Preview em um script, e vi um exemplo disso em GUI, mas não sei como fazê-lo em Dx. GUI EXEMPLO: https://wiki.multitheftauto.com/wiki/Resource:Object_preview Meu código: local dxfont0_fonte = dxCreateFont("font/fonte.ttf", 10) local myObject,myElement = nil, nil local screenW, screenH = guiGetScreenSize() local resW, resH = 1360,768 local x, y = (screenW/resW), (screenH/resH) function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end function menu() color = tocolor(0, 0, 0, 185) if isCursorOnElement(screenW * 0.3294, screenH * 0.3307, screenW * 0.3360, screenH * 0.0495) then -- M4 --exports.preview:setPositionOffsets(m4view,0,1.5,0.1) --exports.preview:setRotation(m4view, getTickCount()/10, 0, 0) color = tocolor(16, 102, 231, 100) end color2 = tocolor(0, 0, 0, 185) if isCursorOnElement(screenW * 0.3294, screenH * 0.3802, screenW * 0.3360, screenH * 0.0495) then -- Desert color2 = tocolor(16, 102, 231, 100) end color3 = tocolor(0, 0, 0, 185) if isCursorOnElement(screenW * 0.3294, screenH * 0.4297, screenW * 0.3360, screenH * 0.0495) then -- Cacetete color3 = tocolor(16, 102, 231, 100) end color4 = tocolor(0, 0, 0, 185) if isCursorOnElement(screenW * 0.3294, screenH * 0.4792, screenW * 0.3360, screenH * 0.0495) then -- Vida e colete color4 = tocolor(16, 102, 231, 100) end colorF = tocolor(0, 0, 0, 0) if isCursorOnElement(screenW * 0.6544, screenH * 0.2656, screenW * 0.0228, screenH * 0.0469) then colorF = tocolor(255, 0, 0, 150) end myElement = createObject(356,0,0,0) myObject = exports.preview:createObjectPreview(myElement,0,0,1,1,1,1, true, true, true) dxDrawRectangle(screenW * 0.3221, screenH * 0.2656, screenW * 0.3551, screenH * 0.4844, tocolor(0, 0, 0, 185), false) dxDrawRectangle(screenW * 0.3221, screenH * 0.2656, screenW * 0.3551, screenH * 0.0469, tocolor(0, 0, 0, 185), false) dxDrawText("Menu de itens - #1066E7PMESP", screenW * 0.3294, screenH * 0.2786, screenW * 0.4971, screenH * 0.3242, tocolor(255, 255, 255, 200), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawRectangle(screenW * 0.6544, screenH * 0.2656, screenW * 0.0228, screenH * 0.0469, colorF, false) dxDrawText("X", screenW * 0.6618, screenH * 0.2786, screenW * 0.8294, screenH * 0.3242, tocolor(255, 255, 255, 200), x*1.30, "default-bold", "left", "top", false, false, false, true, false) dxDrawRectangle(screenW * 0.3294, screenH * 0.3307, screenW * 0.3360, screenH * 0.0495, color, false) dxDrawText("(#1066E7Armamento#FFFFFF) M4", screenW * 0.3368, screenH * 0.3438, screenW * 0.5044, screenH * 0.3893, tocolor(255, 255, 255, 200), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawRectangle(screenW * 0.3294, screenH * 0.3802, screenW * 0.3360, screenH * 0.0495, color2, false) dxDrawText("(#1066E7Armamento#FFFFFF) Desert Eagle", screenW * 0.3368, screenH * 0.3932, screenW * 0.5044, screenH * 0.4388, tocolor(255, 255, 255, 200), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawRectangle(screenW * 0.3294, screenH * 0.4297, screenW * 0.3360, screenH * 0.0495, color3, false) dxDrawText("(#1066E7Armamento#FFFFFF) Cacetete", screenW * 0.3368, screenH * 0.4427, screenW * 0.5044, screenH * 0.4883, tocolor(255, 255, 255, 200), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawRectangle(screenW * 0.3294, screenH * 0.4792, screenW * 0.3360, screenH * 0.0495, color4, false) dxDrawText("Vida e Colete", screenW * 0.3368, screenH * 0.4922, screenW * 0.5044, screenH * 0.5378, tocolor(255, 255, 255, 200), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawRectangle(screenW * 0.3294, screenH * 0.5612, screenW * 0.3360, screenH * 0.1615, tocolor(0, 0, 0, 185), false) end function render() if not isEventHandlerAdded("onClientRender", root, menu) then addEventHandler("onClientRender", root, menu) showCursor(true) showChat(false) -- l_0_1 = true end end addEvent("openMenuPM", true) addEventHandler("openMenuPM", root, render) function close(_,state) if isEventHandlerAdded("onClientRender", root, menu) then if state == "down" then if isCursorOnElement(screenW * 0.6544, screenH * 0.2656, screenW * 0.0228, screenH * 0.0469) then showCursor(false) showChat(true) playSound("sfx/hit.mp3", false) removeEventHandler("onClientRender", root, menu) if l_0_1 then l_0_1 = false end end end end end addEventHandler("onClientClick", root, close) function m4(_,state) if isEventHandlerAdded("onClientRender", root, menu) then if state == "down" then if isCursorOnElement(screenW * 0.3294, screenH * 0.3307, screenW * 0.3360, screenH * 0.0495) then triggerServerEvent("m4", localPlayer) removeEventHandler("onClientRender", root, menu) showChat(true) showCursor(false) playSound("sfx/hit.mp3", false) if l_0_1 then l_0_1 = false end end end end end addEventHandler("onClientClick", root, m4) function isCursorOnElement( posX, posY, width, height ) if isCursorShowing( ) then local mouseX, mouseY = getCursorPosition( ) local clientW, clientH = guiGetScreenSize( ) local mouseX, mouseY = mouseX * clientW, mouseY * clientH if ( mouseX > posX and mouseX < ( posX + width ) and mouseY > posY and mouseY < ( posY + height ) ) then return true end end return false end Link to comment
Other Languages Moderators Lord Henry Posted March 16, 2018 Other Languages Moderators Share Posted March 16, 2018 Cara, ta difícil entender esse código. Ele está muito complexo, com condições separadas em linhas diferentes. Vou deixar em aberto pra outra pessoa responder. 1 Link to comment
DNL291 Posted March 16, 2018 Share Posted March 16, 2018 Você tá criando o objeto e chamando a função do outro resource dentro do "onClientRender". Digite /debugscript 3 e veja o que o debug mostra. 1 Link to comment
Other Languages Moderators Lord Henry Posted March 17, 2018 Other Languages Moderators Share Posted March 17, 2018 (edited) Olá novamente @VazErn. Bom, eu andei estudando esse resource object_preview até saber como usar ele direito e consegui fazer este exemplo em DX (apesar de eu não gostar de painéis DX). O único problema é que qualquer painel que você criar, seja ela em GUI ou DX, vai sempre aparecer na frente do objeto, independente se você tentar mover essa GUI para trás. Mas isso seria problema do próprio object_preview em si que está sempre renderizando atrás de todos os elementos da câmera. Testei aqui e está tudo funcionando normal e sem erros, acabei me empolgando e fazendo alguns botões funcionais no painel xD. Mas ta ae seu exemplo, copie tudo e teste no seu servidor local para ver como funciona. Comando pra abrir o painel: /teste Spoiler local sX, sY = guiGetScreenSize () -- Qualquer coisa que envolva paineis, usa-se isso para receber a resolução atual do usuário. vehID = 401 -- Start vehicle. function createObjectViewer () local x1, y1, z1 = getCameraMatrix() myElement = createVehicle (vehID, x1, y1, z1 + 10) contador = 0 -- O veículo começa com rotação Z sendo 0. thePreview = exports.object_preview:createObjectPreview (myElement, 0, 0, contador, 0.3, (0.2 - 0.1), 0.4, 0.6, true, true, false) -- Cria o veículo na tela. exports.object_preview:setPositionOffsets (thePreview, 0, 4, -2) -- Configura posição do veículo em relação a câmera. rotator = setTimer (function () -- Timer que faz o objeto rotacionar na tela. Ao fechar o painel, este timer é destruído. exports.object_preview:setRotation (thePreview, 0, 0, contador) contador = contador + 1 if contador >= 360 then -- Contador é a rotação Z atual do objeto. contador = 0 end end, 50, 0) -- Rotaciona o objeto 1 grau sentido anti-horário a cada 50 milisegundos. (quase um onClientRender) setVehicleColor (myElement, 255, 0, 0, 255, 255, 255) -- Coloca o veículo em vermelho e branco por padrão. showCursor (true) -- Mostra o cursor na tela para ser possível interagir com o painel. end function openIt () if not isTimer (rotator) then -- Se não estiver com painel aberto (timer de rotação ativo), então: addEventHandler ("onClientRender", getRootElement(), createDXPanel) -- Começa a renderizar o painel DX. createObjectViewer () -- Mostra o veículo na tela e começa os esquemas de configuração de posição e rotação dele. end end addCommandHandler ("teste", openIt) -- Comando para abrir o painel: /teste function createDXPanel () -- Cria o painel DX. dxDrawRectangle (0.3*sX, 0.2*sY, 0.4*sX, 0.6*sY, tocolor (0, 0, 0, 80), false) -- preview background dxDrawRectangle (0.3*sX, 0.8*sY, 0.1*sX, 0.05*sY, tocolor (0, 0, 0, 150), false) -- comprar dxDrawRectangle (0.44*sX, 0.8*sY, 0.05*sX, 0.05*sY, tocolor (0, 0, 0, 150), false) -- anterior dxDrawRectangle (0.51*sX, 0.8*sY, 0.05*sX, 0.05*sY, tocolor (0, 0, 0, 150), false) -- proximo dxDrawRectangle (0.6*sX, 0.8*sY, 0.1*sX, 0.05*sY, tocolor (0, 0, 0, 150), false) -- fechar dxDrawText ("COMPRAR", 0.31*sX, 0.805*sY, 0.1*sX, 0.05*sY, tocolor (0, 255, 0, 255), 2) dxDrawText ("<<", 0.45*sX, 0.805*sY, 0.05*sX, 0.05*sY, tocolor (255, 255, 255, 255), 2) dxDrawText (">>", 0.52*sX, 0.805*sY, 0.05*sX, 0.05*sY, tocolor (255, 255, 255, 255), 2) dxDrawText ("FECHAR", 0.615*sX, 0.805*sY, 0.1*sX, 0.05*sY, tocolor (255, 0, 0, 255), 2) dxDrawLine (0.3*sX, 0.2*sY, 0.3*sX, 0.8*sY, tocolor (255, 255, 255, 150), 2) dxDrawLine (0.7*sX, 0.2*sY, 0.7*sX, 0.8*sY, tocolor (255, 255, 255, 150), 2) dxDrawLine (0.3*sX, 0.2*sY, 0.7*sX, 0.2*sY, tocolor (255, 255, 255, 150), 2) dxDrawLine (0.3*sX, 0.8*sY, 0.7*sX, 0.8*sY, tocolor (255, 255, 255, 150), 2) end function closeIt (button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorldElement) -- A princípio era pra ser só a função de clicar no botão de fechar, mas acabou sendo pra todos os botões. if isTimer (rotator) then -- Se o painel está aberto (com timer ativo), então: if (absoluteX >= 0.6*sX) and (absoluteX <= 0.7*sX) and (absoluteY >= 0.8*sY) and (absoluteY <= 0.85*sY) and state == "down" then -- Se a posição clicada na tela está entre essas coordenadas, então: killTimer (rotator) -- Para de rotacionar o objeto. removeEventHandler ("onClientRender", getRootElement(), createDXPanel) -- Para de renderizar o painel. exports.object_preview:destroyObjectPreview (thePreview) -- Para de mostrar o veículo na tela. (ele não é destruído ainda) destroyElement (myElement) -- Destroi o veículo. myElement = nil -- Limpa a variável usada pelo veículo. showCursor (false) -- Oculta o cursor para permitir que o jogador volte a se movimentar. elseif (absoluteX >= 0.3*sX) and (absoluteX <= 0.4*sX) and (absoluteY >= 0.8*sY) and (absoluteY <= 0.85*sY) and state == "down" then -- Se for na coordenada do botão de comprar, então: outputChatBox ("Teste:#00ff00 OK", 255, 255, 255, true) elseif (absoluteX >= 0.44*sX) and (absoluteX <= 0.49*sX) and (absoluteY >= 0.8*sY) and (absoluteY <= 0.85*sY) and state == "down" then -- Se for na coordenada do botão de anterior, então: previousVehicle () elseif (absoluteX >= 0.51*sX) and (absoluteX <= 0.56*sX) and (absoluteY >= 0.8*sY) and (absoluteY <= 0.85*sY) and state == "down" then -- Se for na coordenada do botão de seguinte, então: nextVehicle () end end end addEventHandler ("onClientClick", getRootElement(), closeIt) function nextVehicle () -- Isso apenas altera o modelo do veículo que está aparecendo, configurei pra ele deixar mais longe ou mais perto da câmera de acordo com o ID do veículo, pois alguns ficavam pequenos demais e outros grandes demais. if vehID <= 610 then vehID = vehID + 1 setElementModel (myElement, vehID) fixVehicle (myElement) if vehID == 577 then exports.object_preview:setPositionOffsets (thePreview, 0, 30, -10) elseif vehID == 592 or vehID == 484 then exports.object_preview:setPositionOffsets (thePreview, 0, 25, -10) elseif vehID == 417 or vehID == 430 then exports.object_preview:setPositionOffsets (thePreview, 0, 10, -5) elseif vehID == 425 then exports.object_preview:setPositionOffsets (thePreview, 0, 10, -3) elseif vehID == 431 or vehID == 437 or vehID == 443 or vehID == 446 or vehID == 454 or vehID == 493 or vehID == 511 or vehID == 519 or vehID == 548 or vehID == 563 or vehID == 590 or vehID == 538 or vehID == 570 or vehID == 537 or vehID == 553 or vehID == 569 then exports.object_preview:setPositionOffsets (thePreview, 0, 7, -3) elseif vehID == 435 then exports.object_preview:setPositionOffsets (thePreview, 0, 6, -2) elseif vehID == 441 or vehID == 581 or vehID == 509 or vehID == 481 or vehID == 462 or vehID == 521 or vehID == 463 or vehID == 510 or vehID == 522 or vehID == 461 or vehID == 448 or vehID == 468 or vehID == 586 or vehID == 457 or vehID == 571 or vehID == 471 or vehID == 464 or vehID == 594 or vehID == 501 or vehID == 465 or vehID == 564 or vehID == 523 or vehID == 485 or vehID == 574 or vehID == 531 or vehID == 530 or vehID == 583 or vehID == 572 or vehID == 539 then exports.object_preview:setPositionOffsets (thePreview, 0, -1, -1) else exports.object_preview:setPositionOffsets (thePreview, 0, 4, -2) end else outputChatBox ("Não existe veículo seguinte.") end end function previousVehicle () -- Mesma coisa só que mostra veículos anteriores. if vehID >= 401 then vehID = vehID - 1 setElementModel (myElement, vehID) fixVehicle (myElement) if vehID == 577 then exports.object_preview:setPositionOffsets (thePreview, 0, 30, -10) elseif vehID == 592 or vehID == 484 then exports.object_preview:setPositionOffsets (thePreview, 0, 25, -10) elseif vehID == 417 or vehID == 430 then exports.object_preview:setPositionOffsets (thePreview, 0, 10, -5) elseif vehID == 425 then exports.object_preview:setPositionOffsets (thePreview, 0, 10, -3) elseif vehID == 431 or vehID == 437 or vehID == 443 or vehID == 446 or vehID == 454 or vehID == 493 or vehID == 511 or vehID == 519 or vehID == 548 or vehID == 563 or vehID == 590 or vehID == 538 or vehID == 570 or vehID == 537 or vehID == 553 or vehID == 569 then exports.object_preview:setPositionOffsets (thePreview, 0, 7, -3) elseif vehID == 435 then exports.object_preview:setPositionOffsets (thePreview, 0, 6, -2) elseif vehID == 441 or vehID == 581 or vehID == 509 or vehID == 481 or vehID == 462 or vehID == 521 or vehID == 463 or vehID == 510 or vehID == 522 or vehID == 461 or vehID == 448 or vehID == 468 or vehID == 586 or vehID == 457 or vehID == 571 or vehID == 471 or vehID == 464 or vehID == 594 or vehID == 501 or vehID == 465 or vehID == 564 or vehID == 523 or vehID == 485 or vehID == 574 or vehID == 531 or vehID == 530 or vehID == 583 or vehID == 572 or vehID == 539 then exports.object_preview:setPositionOffsets (thePreview, 0, -1, -1) else exports.object_preview:setPositionOffsets (thePreview, 0, 4, -2) end else outputChatBox ("Não existe veículo anterior.") end end Edit: Deixei o código comentado pra ajudar a entender o código, pois sei que ficou um tanto complexo. Edited March 17, 2018 by Lord Henry Comentários no código. 1 Link to comment
Vazern Posted March 19, 2018 Author Share Posted March 19, 2018 (edited) Obrigado @DNL291 e Lord Henry pela ajuda! <3 Edited March 19, 2018 by VazErn Link to comment
Other Languages Moderators Lord Henry Posted March 19, 2018 Other Languages Moderators Share Posted March 19, 2018 De nada. Deixe o like naquela resposta. Link to comment
Vazern Posted March 19, 2018 Author Share Posted March 19, 2018 (edited) Não funcionou (fiz algo errado no caso). Eu não sei dizer se fui eu que utilizei de má forma o código que me mandou, mas não funcionou aqui, e o debug não da nenhum erro. Prints: Código (client-side): local sX, sY = guiGetScreenSize () -- Qualquer coisa que envolva paineis, usa-se isso para receber a resolução atual do usuário. objectID = 356 -- Start vehicle. function createObjectViewer() local x1, y1, z1 = getCameraMatrix() myElement = createObject(objectID, x1, y1, z1 + 10) contador = 0 -- O veículo começa com rotação Z sendo 0. thePreview = exports.object_preview:createObjectPreview (myElement, 0, 0, contador, 0.3, (0.2 - 0.1), 0.4, 0.6, true, true, false) -- Cria o veículo na tela. exports.object_preview:setPositionOffsets (thePreview, 0, 4, -2) -- Configura posição do veículo em relação a câmera. rotator = setTimer (function () -- Timer que faz o objeto rotacionar na tela. Ao fechar o painel, este timer é destruído. exports.object_preview:setRotation (thePreview, 0, 0, contador) contador = contador + 1 if contador >= 360 then -- Contador é a rotação Z atual do objeto. contador = 0 end end, 50, 0) -- Rotaciona o objeto 1 grau sentido anti-horário a cada 50 milisegundos. (quase um onClientRender) end local l_0_1 = false local l_0_2, l_0_3 = guiGetScreenSize() local l_0_4 = dxCreateScreenSource(l_0_2, l_0_3) addEventHandler("onClientRender", root, function() if l_0_1 then dxUpdateScreenSource(l_0_4) dxDrawImage(0, 0, l_0_2, l_0_3, l_0_4) end end ) local dxfont0_fonte = dxCreateFont("font/fonte.ttf", 10) local screenW, screenH = guiGetScreenSize() local resW, resH = 1360,768 local x, y = (screenW/resW), (screenH/resH) function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end function menu() color = tocolor(0, 0, 0, 185) if isCursorOnElement(screenW * 0.3294, screenH * 0.3307, screenW * 0.3360, screenH * 0.0495) then -- M4 color = tocolor(16, 102, 231, 100) end color2 = tocolor(0, 0, 0, 185) if isCursorOnElement(screenW * 0.3294, screenH * 0.3802, screenW * 0.3360, screenH * 0.0495) then -- Desert color2 = tocolor(16, 102, 231, 100) end color3 = tocolor(0, 0, 0, 185) if isCursorOnElement(screenW * 0.3294, screenH * 0.4297, screenW * 0.3360, screenH * 0.0495) then -- Cacetete color3 = tocolor(16, 102, 231, 100) end color4 = tocolor(0, 0, 0, 185) if isCursorOnElement(screenW * 0.3294, screenH * 0.4792, screenW * 0.3360, screenH * 0.0495) then -- Vida e colete color4 = tocolor(16, 102, 231, 100) end color5 = tocolor(0, 0, 0, 185) if isCursorOnElement(screenW * 0.3294, screenH * 0.5292, screenW * 0.3360, screenH * 0.0495) then -- Uniforme color5 = tocolor(16, 102, 231, 100) end colorF = tocolor(0, 0, 0, 0) if isCursorOnElement(screenW * 0.6544, screenH * 0.2656, screenW * 0.0228, screenH * 0.0469) then colorF = tocolor(255, 0, 0, 150) end dxDrawRectangle(screenW * 0.3221, screenH * 0.2656, screenW * 0.3551, screenH * 0.3390, tocolor(0, 0, 0, 185), false) dxDrawRectangle(screenW * 0.3221, screenH * 0.2656, screenW * 0.3551, screenH * 0.0469, tocolor(0, 0, 0, 185), false) dxDrawText("Menu de itens - #1066E7PMESP", screenW * 0.3294, screenH * 0.2786, screenW * 0.4971, screenH * 0.3242, tocolor(255, 255, 255, 200), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawRectangle(screenW * 0.6544, screenH * 0.2656, screenW * 0.0228, screenH * 0.0469, colorF, false) dxDrawText("X", screenW * 0.6618, screenH * 0.2786, screenW * 0.8294, screenH * 0.3242, tocolor(255, 255, 255, 200), x*1.30, "default-bold", "left", "top", false, false, false, true, false) dxDrawRectangle(screenW * 0.3294, screenH * 0.3307, screenW * 0.3360, screenH * 0.0495, color, false) dxDrawText("(#1066E7Arma#FFFFFF) M4", screenW * 0.3368, screenH * 0.3438, screenW * 0.5044, screenH * 0.3893, tocolor(255, 255, 255, 200), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawRectangle(screenW * 0.3294, screenH * 0.3802, screenW * 0.3360, screenH * 0.0495, color2, false) dxDrawText("(#1066E7Arma#FFFFFF) Desert Eagle", screenW * 0.3368, screenH * 0.3932, screenW * 0.5044, screenH * 0.4388, tocolor(255, 255, 255, 200), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawRectangle(screenW * 0.3294, screenH * 0.4297, screenW * 0.3360, screenH * 0.0495, color3, false) dxDrawText("(#1066E7Arma#FFFFFF) Cacetete", screenW * 0.3368, screenH * 0.4427, screenW * 0.5044, screenH * 0.4883, tocolor(255, 255, 255, 200), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawRectangle(screenW * 0.3294, screenH * 0.4792, screenW * 0.3360, screenH * 0.0495, color4, false) dxDrawText("(#1066E7Itens#FFFFFF) Vida e Colete", screenW * 0.3368, screenH * 0.4922, screenW * 0.5044, screenH * 0.5378, tocolor(255, 255, 255, 200), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawRectangle(screenW * 0.3294, screenH * 0.5292, screenW * 0.3360, screenH * 0.0495, color5, false) dxDrawText("(#1066E7Itens#FFFFFF) Uniforme", screenW * 0.3368, screenH * 0.5417, screenW * 0.5044, screenH * 0.5378, tocolor(255, 255, 255, 200), x*1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) end function disableBlur() setElementData(localPlayer, "showBlur", false) end addEventHandler("onClientResourceStop", resourceRoot, disableBlur) function render() if not isTimer (rotator) then if not isEventHandlerAdded("onClientRender", root, menu) then addEventHandler("onClientRender", root, menu) showCursor(true) showChat(false) createObjectViewer() -- l_0_1 = true setElementData(localPlayer, "showBlur", true) end end end addEvent("openMenuPM", true) addEventHandler("openMenuPM", root, render) function close(_,state) if isEventHandlerAdded("onClientRender", root, menu) then if state == "down" then if isCursorOnElement(screenW * 0.6544, screenH * 0.2656, screenW * 0.0228, screenH * 0.0469) then showCursor(false) showChat(true) playSound("sfx/hit.mp3", false) removeEventHandler("onClientRender", root, menu) setElementData(localPlayer, "showBlur", false) killTimer (rotator) exports.object_preview:destroyObjectPreview (thePreview) destroyElement (myElement) myElement = nil if l_0_1 then l_0_1 = false end end end end end addEventHandler("onClientClick", root, close) function m4(_,state) if isEventHandlerAdded("onClientRender", root, menu) then if state == "down" then if isCursorOnElement(screenW * 0.3294, screenH * 0.3307, screenW * 0.3360, screenH * 0.0495) then triggerServerEvent("m4", localPlayer) removeEventHandler("onClientRender", root, menu) setElementData(localPlayer, "showBlur", false) killTimer (rotator) exports.object_preview:destroyObjectPreview (thePreview) destroyElement (myElement) myElement = nil showChat(true) showCursor(false) playSound("sfx/hit.mp3", false) if l_0_1 then l_0_1 = false end end end end end addEventHandler("onClientClick", root, m4) function deagle(_,state) if isEventHandlerAdded("onClientRender", root, menu) then if state == "down" then if isCursorOnElement(screenW * 0.3294, screenH * 0.3802, screenW * 0.3360, screenH * 0.0495) then triggerServerEvent("deagle", localPlayer) removeEventHandler("onClientRender", root, menu) setElementData(localPlayer, "showBlur", false) killTimer (rotator) exports.object_preview:destroyObjectPreview (thePreview) destroyElement (myElement) myElement = nil showChat(true) showCursor(false) playSound("sfx/hit.mp3", false) if l_0_1 then l_0_1 = false end end end end end addEventHandler("onClientClick", root, deagle) function cacetete(_,state) if isEventHandlerAdded("onClientRender", root, menu) then if state == "down" then if isCursorOnElement(screenW * 0.3294, screenH * 0.4297, screenW * 0.3360, screenH * 0.0495) then triggerServerEvent("cacetete", localPlayer) removeEventHandler("onClientRender", root, menu) setElementData(localPlayer, "showBlur", false) killTimer (rotator) exports.object_preview:destroyObjectPreview (thePreview) destroyElement (myElement) myElement = nil showChat(true) showCursor(false) playSound("sfx/hit.mp3", false) if l_0_1 then l_0_1 = false end end end end end addEventHandler("onClientClick", root, cacetete) function vidaC(_,state) if isEventHandlerAdded("onClientRender", root, menu) then if state == "down" then if isCursorOnElement(screenW * 0.3294, screenH * 0.4792, screenW * 0.3360, screenH * 0.0495) then triggerServerEvent("vidaC", localPlayer) removeEventHandler("onClientRender", root, menu) setElementData(localPlayer, "showBlur", false) killTimer (rotator) exports.object_preview:destroyObjectPreview (thePreview) destroyElement (myElement) myElement = nil showChat(true) showCursor(false) playSound("sfx/hit.mp3", false) if l_0_1 then l_0_1 = false end end end end end addEventHandler("onClientClick", root, vidaC) function setUniforme(_,state) if isEventHandlerAdded("onClientRender", root, menu) then if state == "down" then if isCursorOnElement(screenW * 0.3294, screenH * 0.5292, screenW * 0.3360, screenH * 0.0495) then setElementModel(localPlayer, 280) removeEventHandler("onClientRender", root, menu) setElementData(localPlayer, "showBlur", false) killTimer (rotator) exports.object_preview:destroyObjectPreview (thePreview) destroyElement (myElement) myElement = nil showChat(true) showCursor(false) playSound("sfx/hit.mp3", false) if l_0_1 then l_0_1 = false end end end end end addEventHandler("onClientClick", root, setUniforme) function isCursorOnElement( posX, posY, width, height ) if isCursorShowing( ) then local mouseX, mouseY = getCursorPosition( ) local clientW, clientH = guiGetScreenSize( ) local mouseX, mouseY = mouseX * clientW, mouseY * clientH if ( mouseX > posX and mouseX < ( posX + width ) and mouseY > posY and mouseY < ( posY + height ) ) then return true end end return false end Edited March 19, 2018 by VazErn Link to comment
Other Languages Moderators Lord Henry Posted March 19, 2018 Other Languages Moderators Share Posted March 19, 2018 (edited) Cara, não faço ideia do que vc fez xD. Pq vc colocou isso na linha 20? local l_0_2, l_0_3 = guiGetScreenSize() Se já tem na primeira linha? Edited March 19, 2018 by Lord Henry Link to comment
Vazern Posted March 20, 2018 Author Share Posted March 20, 2018 Se ler o resto, isso aí oculta os componentes na tela (como a hud), mas eu o desativei pois com ele o Blur que uso não funciona. 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