Jump to content

Ajuda painel DX


Recommended Posts

Estou tentando criar um painel para uma corporação e estou com uma problema, bom a ideia do painel seria pra quando o policial entrasse num determinado marker aparecesse um painel com as funções de pegar os equipamentos, guardar os equipamentos e pegar a viatura.

Eu até consegui fazer o painel aparecer com a ajuda de alguns tópicos criados aqui mas ele aparece por um milésimo e desaparece se alguém poder me ajudar ficarei grato.

Quote
local screenW,screenH = guiGetScreenSize()
local resW, resH = 1280960
local x, y =  (screenW/resW), (screenH/resH)
    
    painel = true
 
    function Painel ()
    dxDrawRectangle(x*358, y*144, x*631, y*420tocolor(000197), false)
    dxDrawRectangle(x*358, y*144, x*631, y*47tocolor(000203), false)
    dxDrawText("Divinity Police",x*519, y*145, x*833, y*191tocolor(254254254203), 1.50"pricedown""center""center"falsefalsefalsefalsefalse)
    dxDrawRectangle(x*358, y*243, x*632, y*58tocolor(616161203), false)
    dxDrawRectangle(x*358, y*347, x*632, y*58tocolor(616161203), false)
    dxDrawRectangle(x*358, y*438, x*632, y*58tocolor(616161203), false)
    dxDrawText("Pegar equipamentos", x*518, y*253, x*832, y*299tocolor(254254254203), 1.50"pricedown""center""center"falsefalsefalsefalsefalse)
    dxDrawText("Guardar equipamentos", x*515, y*357, x*829, y*403tocolor(254254254203), 1.50"pricedown""center""center"falsefalsefalsefalsefalse)
    dxDrawText("Pegar viatura", x*515, y*448, x*829, y*494tocolor(254254254203), 1.50"pricedown""center""center"falsefalsefalsefalsefalse)
    dxDrawText("X", x*915, y*153, x*961, y*185tocolor(255255255255), 3.00"default""center""center"falsefalsefalsefalsefalse)
      
    addEventHandler("onClientRender"root, Dx)
    end
    addEvent("Abrir_Painel"true)
    addEventHandler("Abrir_Painel"root, Painel)
Quote
marker = createMarker (1539.21252-1647.535894.89063"cylinder"1.5 ,50,100,100)
 
function Open_Painel (source)   
    triggerClientEvent(source, "Abrir_Painel", source)   
end
addEventHandler("onMarkerHit", marker, Open_Painel)

 

o 1° seria o client.Lua e o 2° o server.Lua

me desculpa se usei algum recurso errado é que sou novo aqui no fórum :/

Link to comment
--/> Client-Side
local screenW,screenH = guiGetScreenSize()
local resW, resH = 1280, 960
local x, y =  (screenW/resW), (screenH/resH)
local painel = false 
 
function dx_Painel ()
   if painel == true then
      dxDrawRectangle(x*358, y*144, x*631, y*420, tocolor(0, 0, 0, 197), false)
      dxDrawRectangle(x*358, y*144, x*631, y*47, tocolor(0, 0, 0, 203), false)
      dxDrawText("Divinity Police",x*519, y*145, x*833, y*191, tocolor(254, 254, 254, 203), 1.50, "pricedown", "center", "center", false, false, false, false, false)
      dxDrawRectangle(x*358, y*243, x*632, y*58, tocolor(61, 61, 61, 203), false)
      dxDrawRectangle(x*358, y*347, x*632, y*58, tocolor(61, 61, 61, 203), false)
      dxDrawRectangle(x*358, y*438, x*632, y*58, tocolor(61, 61, 61, 203), false)
      dxDrawText("Pegar equipamentos", x*518, y*253, x*832, y*299, tocolor(254, 254, 254, 203), 1.50, "pricedown", "center", "center", false, false, false, false, false)
      dxDrawText("Guardar equipamentos", x*515, y*357, x*829, y*403, tocolor(254, 254, 254, 203), 1.50, "pricedown", "center", "center", false, false, false, false, false)
      dxDrawText("Pegar viatura", x*515, y*448, x*829, y*494, tocolor(254, 254, 254, 203), 1.50, "pricedown", "center", "center", false, false, false, false, false)
      dxDrawText("X", x*915, y*153, x*961, y*185, tocolor(255, 255, 255, 255), 3.00, "default", "center", "center", false, false, false, false, false)
   end
end

function abrir_painel ()
   if painel == false then
      addEventHandler("onClientRender", getRootElement(), dx_Painel)
      painel = true
   end
end
addEvent("Event:Abrir_Painel_Police", true)
addEventHandler("Event:Abrir_Painel_Police", getRootElement(), abrir_painel)

function fechar_painel () --/> Fechar o Painel / Não Esta Funcional é um Exemplo, Precisará Implementa no seu Script.
   if painel == true then
      painel = false
      removeEventHandler("onClientRender", getRootElement(), dx_Painel)
   end
end
--/> Server-Side
local marker = createMarker (1539.21252, -1647.53589, 4.89063, "cylinder", 1.5 ,50,100,100)

function abrir_painel (hitElement)   
   if getElementType(hitElement) == "player" then
      triggerClientEvent(hitElement, "Event:Abrir_Painel_Police", hitElement)   
   end
end
addEventHandler("onMarkerHit", marker, abrir_painel)

 

Edited by Angelo Pereira
  • Thanks 1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...