Jump to content

Menu de staff


Recommended Posts

Estou fazendo um menu para a staff que quando eu clico em weapon o outro menu nao abre!

Spoiler
local sW, sH = guiGetScreenSize()
local resW, resH = 1360,768
local x, y = (sW/resW), (sH/resH)

local eulenmenu = false
local eulen_exibir = false
function eulenmenu()
   
    dxDrawBordRectangle(x*150, y*69, x*693, y*434, 10, tocolor(11, 12, 34, 255), false)
    dxDrawBordRectangle(x*150, y*96, x*693, y*5, tocolor(103, 103, 103, 255), false)
    dxDrawBordRectangle(x*168, y*74, x*69, y*16, 3, tocolor(103, 103, 103, 255), false)
    dxDrawBordRectangle(x*252, y*74, x*69, y*16, 3, tocolor(103, 103, 103, 255), false)
    dxDrawBordRectangle(x*335, y*74, x*69, y*16, 3, tocolor(103, 103, 103, 255), false)
    dxDrawBordRectangle(x*418, y*74, x*69, y*16, 3, tocolor(103, 103, 103, 255), false)
    dxDrawBordRectangle(x*499, y*74, x*69, y*16, 3, tocolor(103, 103, 103, 255), false)
    dxDrawText('VISUALS', x*180, y*74, x*69, y*16, tocolor(255, 255, 255, 255), 1.0, 'default', 'left', 'top')
    dxDrawText('WEAPON', x*265, y*74, x*69, y*16, tocolor(255, 255, 255, 255), 1.0, 'default', 'left', 'top')
    dxDrawText('VEHICLE', x*347, y*74, x*69, y*16, tocolor(255, 255, 255, 255), 1.0, 'default', 'left', 'top')
    dxDrawText('PLAYER', x*432, y*74, x*69, y*16, tocolor(255, 255, 255, 255), 1.0, 'default', 'left', 'top')
    dxDrawText('PVP', x*522, y*74, x*69, y*16, tocolor(255, 255, 255, 255), 1.0, 'default', 'left', 'top')
 
end
 
local weapon = false
function weapon()
   
    dxDrawBordRectangle(x*150, y*69, x*693, y*434, 10, tocolor(11, 12, 34, 255), false)
    dxDrawBordRectangle(x*150, y*96, x*693, y*5, tocolor(103, 103, 103, 255), false)
    dxDrawBordRectangle(x*168, y*74, x*69, y*16, 3, tocolor(103, 103, 103, 255), false) -- visuals
    dxDrawBordRectangle(x*252, y*74, x*69, y*16, 3, tocolor(103, 103, 103, 255), false) -- weapon
    dxDrawBordRectangle(x*335, y*74, x*69, y*16, 3, tocolor(103, 103, 103, 255), false)
    dxDrawBordRectangle(x*418, y*74, x*69, y*16, 3, tocolor(103, 103, 103, 255), false)
    dxDrawBordRectangle(x*499, y*74, x*69, y*16, 3, tocolor(103, 103, 103, 255), false)
    dxDrawText('nada', x*180, y*74, x*69, y*16, tocolor(255, 255, 255, 255), 1.0, 'default', 'left', 'top')
    dxDrawText('WEAPON', x*265, y*74, x*69, y*16, tocolor(255, 255, 255, 255), 1.0, 'default', 'left', 'top')
    dxDrawText('nada', x*347, y*74, x*69, y*16, tocolor(255, 255, 255, 255), 1.0, 'default', 'left', 'top')
    dxDrawText('nada', x*432, y*74, x*69, y*16, tocolor(255, 255, 255, 255), 1.0, 'default', 'left', 'top')
    dxDrawText('nada', x*522, y*74, x*69, y*16, tocolor(255, 255, 255, 255), 1.0, 'default', 'left', 'top')
 
end
 
-- Funções Utils
 
local SvgsRectangle = {}
 
function dxDrawBordRectangle(x, y, w, h, radius, color, post)
    if not SvgsRectangle[radius] then
        SvgsRectangle[radius] = {}
    end
    if not SvgsRectangle[radius][w] then
        SvgsRectangle[radius][w] = {}
    end
    if not SvgsRectangle[radius][w][h] then
        local Path = string.format([[
            <svg width="%s" height="%s" viewBox="0 0 %s %s" fill="none" xmlns="http://www.w3.org/2000/svg">
            <rect opacity="1" width="%s" height="%s" rx="%s" fill="#FFFFFF"/>
            </svg>
        ]], w, h, w, h, w, h, radius)
        SvgsRectangle[radius][w][h] = svgCreate(w, h, Path)
    end
    if SvgsRectangle[radius][w][h] then
        dxDrawImage(x, y, w, h, SvgsRectangle[radius][w][h], 0, 0, 0, color, post)
    end
end
 
_dxDrawText = dxDrawText
function dxDrawText (text, x, y, w, h, ...)
    return _dxDrawText (text, x, y, (x + w), (y + h), ...)
end
 
addCommandHandler("eulen", function()
    if eulen_exibir == false then
        addEventHandler("onClientRender", getRootElement(), eulenmenu)
        eulen_exibir = true
        showCursor(true)
    else
        removeEventHandler("onClientRender", getRootElement(), eulenmenu)
        eulen_exibir = 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
 
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 eulen_exibir== true then
            if isMouseInPosition(x*252, y*74, x*69, y*16, 3) then
                eulen = false
                weapon = true
            end
        end
    end
end)

 

 
Edited by Lord Henry
Código convertido de texto para Lua.
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...