Jump to content

Painel DX abre e fecha Instantâneamente


Recommended Posts

quando eu passo no marke ele pisca ligeiramente:
 

--Server
function MensagemMarker(thePlayer)
    if not getPedOccupiedVehicle(thePlayer) then
        if getElementData(thePlayer, "EntregadorD") == false then
        outputChatBox("Para Entregar Drogas Digite /drogas", thePlayer, 255, 255, 255, true)
        triggerClientEvent(thePlayer, "Open:Ilegal", thePlayer)
        else
        outputChatBox("Para Sair Dessa Vida Digite /drogas", thePlayer, 255, 255, 255, true)
        end
    end
end
addEventHandler("onMarkerHit", MarkerEmprego, MensagemMarker)
-- Client
local screenW, screenH = guiGetScreenSize()

local states = false

    function DX_Entregas()
        if not isCursorShowing() then
        showCursor(true)
        dxDrawRectangle(screenW * 0.3794, screenH * 0.2467, screenW * 0.2288, screenH * 0.4833, tocolor(31, 31, 31, 255), false)
        dxDrawRectangle(screenW * 0.3794, screenH * 0.2356, screenW * 0.2288, screenH * 0.0111, tocolor(116, 0, 165, 255), false)
        dxDrawRoundedRectangle(screenW * 0.3956, screenH * 0.2711, screenW * 0.1969, screenH * 0.3333, 15, tocolor(82, 82, 82, 224), false)
        dxDrawRoundedRectangle(screenW * 0.4019, screenH * 0.6444, screenW * 0.0769, screenH * 0.0533, 15, tocolor(82, 82, 82, 224), false)
        dxDrawRoundedRectangle(screenW * 0.5094, screenH * 0.6444, screenW * 0.0769, screenH * 0.0533, 15, tocolor(82, 82, 82, 224), false)
        dxDrawText("SIM", screenW * 0.4200, screenH * 0.6489, screenW * 0.4788, screenH * 0.6778, tocolor(25, 232, 4, 255), 3.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("NÃO", screenW * 0.5240, screenH * 0.6489, screenW * 0.5837, screenH * 0.6778, tocolor(237, 0, 0, 255), 3.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Você quer trabalhar entregando drogas?", screenW * 0.4200, screenH * 0.2822, screenW * 0.6019, screenH * 0.3122, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("--Receber uma van no local ao lado", screenW * 0.4044, screenH * 0.3267, screenW * 0.5863, screenH * 0.3567, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("--Entregar a carga em um local secreto", screenW * 0.4044, screenH * 0.3567, screenW * 0.5863, screenH * 0.3867, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("--Receber de 10000 a 13000 de Dinheiro Sujo", screenW * 0.4044, screenH * 0.3867, screenW * 0.5863, screenH * 0.4211, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
    end
end

addEvent("Open:Ilegal", true)
addEventHandler("Open:Ilegal", root, function()
    if states == false then
    addEventHandler("onClientRender", getRootElement(), DX_Entregas)
    states = true
  else
     removeEventHandler("onClientRender", getRootElement(), DX_Entregas)
     states = false
    end
end)

 

Link to comment
  • Other Languages Moderators

Isso acontece devido a sua condição if not isCursorShowing() then pois ela se torna false depois que o cursor fica visível.

Tire essa condição dali e também o showCursor. Coloque o showCursor lá em baixo na função que adiciona/remove o onClientRender.

local screenW, screenH = guiGetScreenSize()
local states = false

function DX_Entregas()
    dxDrawRectangle(screenW * 0.3794, screenH * 0.2467, screenW * 0.2288, screenH * 0.4833, tocolor(31, 31, 31, 255), false)
    dxDrawRectangle(screenW * 0.3794, screenH * 0.2356, screenW * 0.2288, screenH * 0.0111, tocolor(116, 0, 165, 255), false)
    dxDrawRoundedRectangle(screenW * 0.3956, screenH * 0.2711, screenW * 0.1969, screenH * 0.3333, 15, tocolor(82, 82, 82, 224), false)
    dxDrawRoundedRectangle(screenW * 0.4019, screenH * 0.6444, screenW * 0.0769, screenH * 0.0533, 15, tocolor(82, 82, 82, 224), false)
    dxDrawRoundedRectangle(screenW * 0.5094, screenH * 0.6444, screenW * 0.0769, screenH * 0.0533, 15, tocolor(82, 82, 82, 224), false)
    dxDrawText("SIM", screenW * 0.4200, screenH * 0.6489, screenW * 0.4788, screenH * 0.6778, tocolor(25, 232, 4, 255), 3.00, "default-bold", "left", "top", false, false, false, false, false)
    dxDrawText("NÃO", screenW * 0.5240, screenH * 0.6489, screenW * 0.5837, screenH * 0.6778, tocolor(237, 0, 0, 255), 3.00, "default-bold", "left", "top", false, false, false, false, false)
    dxDrawText("Você quer trabalhar entregando drogas?", screenW * 0.4200, screenH * 0.2822, screenW * 0.6019, screenH * 0.3122, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
    dxDrawText("--Receber uma van no local ao lado", screenW * 0.4044, screenH * 0.3267, screenW * 0.5863, screenH * 0.3567, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
    dxDrawText("--Entregar a carga em um local secreto", screenW * 0.4044, screenH * 0.3567, screenW * 0.5863, screenH * 0.3867, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
    dxDrawText("--Receber de 10000 a 13000 de Dinheiro Sujo", screenW * 0.4044, screenH * 0.3867, screenW * 0.5863, screenH * 0.4211, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
end

addEvent("Open:Ilegal", true)
addEventHandler("Open:Ilegal", root, function()
    if states then
        removeEventHandler("onClientRender", root, DX_Entregas)
    else
        addEventHandler("onClientRender", root, DX_Entregas)
    end
    states = not states -- Alterna states entre true e false a cada vez.
    showCursor(states)
end)

 

  • Thanks 1
Link to comment
8 hours ago, Lord Henry said:

Isso acontece devido a sua condição if not isCursorShowing() then pois ela se torna false depois que o cursor fica visível.

Tire essa condição dali e também o showCursor. Coloque o showCursor lá em baixo na função que adiciona/remove o onClientRender.

local screenW, screenH = guiGetScreenSize()
local states = false

function DX_Entregas()
    dxDrawRectangle(screenW * 0.3794, screenH * 0.2467, screenW * 0.2288, screenH * 0.4833, tocolor(31, 31, 31, 255), false)
    dxDrawRectangle(screenW * 0.3794, screenH * 0.2356, screenW * 0.2288, screenH * 0.0111, tocolor(116, 0, 165, 255), false)
    dxDrawRoundedRectangle(screenW * 0.3956, screenH * 0.2711, screenW * 0.1969, screenH * 0.3333, 15, tocolor(82, 82, 82, 224), false)
    dxDrawRoundedRectangle(screenW * 0.4019, screenH * 0.6444, screenW * 0.0769, screenH * 0.0533, 15, tocolor(82, 82, 82, 224), false)
    dxDrawRoundedRectangle(screenW * 0.5094, screenH * 0.6444, screenW * 0.0769, screenH * 0.0533, 15, tocolor(82, 82, 82, 224), false)
    dxDrawText("SIM", screenW * 0.4200, screenH * 0.6489, screenW * 0.4788, screenH * 0.6778, tocolor(25, 232, 4, 255), 3.00, "default-bold", "left", "top", false, false, false, false, false)
    dxDrawText("NÃO", screenW * 0.5240, screenH * 0.6489, screenW * 0.5837, screenH * 0.6778, tocolor(237, 0, 0, 255), 3.00, "default-bold", "left", "top", false, false, false, false, false)
    dxDrawText("Você quer trabalhar entregando drogas?", screenW * 0.4200, screenH * 0.2822, screenW * 0.6019, screenH * 0.3122, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
    dxDrawText("--Receber uma van no local ao lado", screenW * 0.4044, screenH * 0.3267, screenW * 0.5863, screenH * 0.3567, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
    dxDrawText("--Entregar a carga em um local secreto", screenW * 0.4044, screenH * 0.3567, screenW * 0.5863, screenH * 0.3867, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
    dxDrawText("--Receber de 10000 a 13000 de Dinheiro Sujo", screenW * 0.4044, screenH * 0.3867, screenW * 0.5863, screenH * 0.4211, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
end

addEvent("Open:Ilegal", true)
addEventHandler("Open:Ilegal", root, function()
    if states then
        removeEventHandler("onClientRender", root, DX_Entregas)
    else
        addEventHandler("onClientRender", root, DX_Entregas)
    end
    states = not states -- Alterna states entre true e false a cada vez.
    showCursor(states)
end)

 

mano muito obrigado, eu tava quebrando a cabeça kkk, errinho bobo, lord henry salvando vidas

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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