Jump to content

[HELP]


Recommended Posts

33 minutes ago, Firespider said:
X2 and Y2 are the x of panel + panel size and y of panel + panel size

 

 

X2 and Y2 are the x of panel + panel size and y of panel + panel size

I don't understand what with what.

Well i see there is too 'gombl' dx draw in your screen shot

Btw if u mean the first 'gombl' use 
 

sy,sy = guiGetScreenSize()
if isInBox(sx*.40,sy*.47,sx*.06,sx*.05) then 


If u mean the second 'gombl' use 
 

sx,sy = guiGetScreenSize()
if IsInBox(sx*.55,sy*.47,sx*.06,sy*.05) then

That what i got after trying to understand 

Link to comment
8 hours ago, Firespider said:

unknown.png

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
------------
color = tocolor(0, 0, 0, 180) --Here is the color of the button I made
------------
dxDrawRectangle(sx*.40, sy*.47, sx*.06, sy*.05, color1 or color, false) --gombl

------------
if isMouseInPosition(sx*.40, sy*.47, sx*.06, sy*.05) then
    color1 = tocolor(88, 0, 0, 50) --And here you put any color when the mouse touches the button, a color appears
    else
        color1 = color
end

 

try this

Edited by Mr.Hugin
  • Like 1
Link to comment

unknown.png

unknown.png

That way it can be more transparent
 
 
 

ocal sx,sy = guiGetScreenSize();--1920,1080
local relx,rely = sx/1920,sy/1080;

local cardPed = createPed(1, 337.536, -1358.894, 14.508, 280)
local shopWindow = {0.3, 0.25}
local IsCardShop = false
local money = getPlayerMoney(localPlayer)
local Cardlist = {
[1] = {411, "Jogosítvány", 1000},
[2] = {482, "Jogosítvány", 10000},
};

function isInBox(x,y,x2,y2)
    if (isCursorShowing()) then
        local cX, cY = getCursorPosition();
      if ( (cX >= x) and (cY >= y) and (cX <= x2) and (cY <= y2) ) then
           return true;
        else
           return false;        
        end 
    end
end

local Buttoncolors = {
[1] = tocolor(49, 230, 32, 250);
}

addEventHandler("onClientRender", root,
    function()
       if (IsCardShop) then 
          dxDrawRectangle(sx*.35, sy*.35, sx*.30, sy*.05, tocolor(0, 0, 0, 200))--Fejléc    
            dxDrawText("Jogosítvány", sx*.50, sy*.035, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
          dxDrawRectangle(sx*.35, sy*.40, sx*.30, sy*.20, tocolor(30, 40, 50, 250))-- panel 
          dxDrawRectangle(sx*.40, sy*.47, sx*.06, sy*.05, tocolor(49, 230, 32, 250))--gomb1
            dxDrawText("Megvétel", sx*.36, sy*.27, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
            dxDrawText("Legális 1000$", sx*.36, sy*.19, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
          dxDrawRectangle(sx*0.55, sy*0.47, sx*0.06, sy*0.05, Buttoncolors[1])--gomb1
            dxDrawText("Megvétel", sx*.66, sy*.27, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat          
          dxDrawText("Ilegális 10000$", sx*.66, sy*.19, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
          dxDrawText("Összeged: "..money.."$", sx*.52, sy*.40, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat

           
        end        
    end    
);


bindKey("BACKSPACE","down",function() if IsCardShop == true then IsCardShop = false end end )    

    
function showCard(index)

end

addEventHandler("onClientClick", root, function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld)
    if (button == "right") and (state == "up") then
        IsCardShop = true--- 
    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
------------
color = tocolor(230, 32, 250, 180) --Here is the color of the button I made
------------
dxDrawRectangle(sx*.40, sy*.47, sx*.06, sy*.05, color1 or color, false) --gombl

------------
if isMouseInPosition(sx*.40, sy*.47, sx*.06, sy*.05) then
    color1 = tocolor(88, 0, 0, 50) --And here you put any color when the mouse touches the button, a color appears
    else
        color1 = color
end

Link to comment
3 hours ago, Firespider said:

unknown.png

unknown.png

That way it can be more transparent
 
 
 

ocal sx,sy = guiGetScreenSize();--1920,1080
local relx,rely = sx/1920,sy/1080;

local cardPed = createPed(1, 337.536, -1358.894, 14.508, 280)
local shopWindow = {0.3, 0.25}
local IsCardShop = false
local money = getPlayerMoney(localPlayer)
local Cardlist = {
[1] = {411, "Jogosítvány", 1000},
[2] = {482, "Jogosítvány", 10000},
};

function isInBox(x,y,x2,y2)
    if (isCursorShowing()) then
        local cX, cY = getCursorPosition();
      if ( (cX >= x) and (cY >= y) and (cX <= x2) and (cY <= y2) ) then
           return true;
        else
           return false;        
        end 
    end
end

local Buttoncolors = {
[1] = tocolor(49, 230, 32, 250);
}

addEventHandler("onClientRender", root,
    function()
       if (IsCardShop) then 
          dxDrawRectangle(sx*.35, sy*.35, sx*.30, sy*.05, tocolor(0, 0, 0, 200))--Fejléc    
            dxDrawText("Jogosítvány", sx*.50, sy*.035, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
          dxDrawRectangle(sx*.35, sy*.40, sx*.30, sy*.20, tocolor(30, 40, 50, 250))-- panel 
          dxDrawRectangle(sx*.40, sy*.47, sx*.06, sy*.05, tocolor(49, 230, 32, 250))--gomb1
            dxDrawText("Megvétel", sx*.36, sy*.27, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
            dxDrawText("Legális 1000$", sx*.36, sy*.19, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
          dxDrawRectangle(sx*0.55, sy*0.47, sx*0.06, sy*0.05, Buttoncolors[1])--gomb1
            dxDrawText("Megvétel", sx*.66, sy*.27, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat          
          dxDrawText("Ilegális 10000$", sx*.66, sy*.19, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
          dxDrawText("Összeged: "..money.."$", sx*.52, sy*.40, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat

           
        end        
    end    
);


bindKey("BACKSPACE","down",function() if IsCardShop == true then IsCardShop = false end end )    

    
function showCard(index)

end

addEventHandler("onClientClick", root, function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld)
    if (button == "right") and (state == "up") then
        IsCardShop = true--- 
    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
------------
color = tocolor(230, 32, 250, 180) --Here is the color of the button I made
------------
dxDrawRectangle(sx*.40, sy*.47, sx*.06, sy*.05, color1 or color, false) --gombl

------------
if isMouseInPosition(sx*.40, sy*.47, sx*.06, sy*.05) then
    color1 = tocolor(88, 0, 0, 50) --And here you put any color when the mouse touches the button, a color appears
    else
        color1 = color
end

local sx,sy = guiGetScreenSize();--1920,1080
local relx,rely = sx/1920,sy/1080;
-----------
IsCardShop = false
local money = getPlayerMoney(localPlayer)
local Cardlist = {
[1] = {411, "Jogosítvány", 1000},
[2] = {482, "Jogosítvány", 10000},
};
color = tocolor(255, 0, 0, 255)
-----------
function Panel()
       if IsCardShop == true then 
          dxDrawRectangle(sx*.35, sy*.35, sx*.30, sy*.05, tocolor(0, 0, 0, 200))--Fejléc    
            dxDrawText("Jogosítvány", sx*.50, sy*.035, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
          dxDrawRectangle(sx*.35, sy*.40, sx*.30, sy*.20, tocolor(30, 40, 50, 250))-- panel 
          dxDrawRectangle(sx*.40, sy*.47, sx*.06, sy*.05, color1 or color)--gomb1
            dxDrawText("Megvétel", sx*.36, sy*.27, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
            dxDrawText("Legális 1000$", sx*.36, sy*.19, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
          dxDrawRectangle(sx*0.55, sy*0.47, sx*0.06, sy*0.05, color2 or color)--gomb1
            dxDrawText("Megvétel", sx*.66, sy*.27, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat          
          dxDrawText("Ilegális 10000$", sx*.66, sy*.19, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
          dxDrawText("Összeged: "..money.."$", sx*.52, sy*.40, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat
-----------
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
-----------
if isMouseInPosition(sx*.40, sy*.47, sx*.06, sy*.05) then
  color1 = tocolor(88, 0, 0, 50)
  else
    color1 = color
end
-----------
if isMouseInPosition(sx*0.55, sy*0.47, sx*0.06, sy*0.05) then
    color2 = tocolor(88, 0, 0, 50)
    else
      color2 = color
end
end
end
-----------
function OpenWindow()
    IsCardShop = not IsCardShop
    if removeEventHandler("onClientRender", root, Panel) then
    removeEventHandler("onClientRender", root, Panel)
    showCursor(false)
else
    addEventHandler("onClientRender", root, Panel)
    showCursor(true)
end
end
bindKey("F3", "down", OpenWindow)

try this

Link to comment
40 minutes ago, Firespider said:
It is not necessary to solve the problem of opening it by pressing the F3 button, but how to calculate the Cy Cx value.
 
 
 
And if it is there, the button will light up when you move the cursor over it.
 
 
 

Yes, you do not have to open a panel, but now you have the buttons that light up. Try this and you will know for yourself

Link to comment
No, you know, the pads are included in the game and if you click on them, the panel will appear
 
 
 
 
 
 
 

addEventHandler("onClientClick", root, function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld)
    if (button == "right") and (state == "up") then
        IsCardShop = true--- 
    end
end) 

That's what I mean
 
 
 
Is this also possible with the new code?
 
 
 
So I don't mean that if a button is pressed, the panel opens, but if a player clicks on a Ped, the panel opens.
 
 
 
Anyway, thanks for the code you sent, I'll try it later. and if everything is true, I have already solved the ped thing
 
 
 
Link to comment
7 hours ago, Firespider said:
No, you know, the pads are included in the game and if you click on them, the panel will appear
 
 
 
 
 
 
 

addEventHandler("onClientClick", root, function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld)
    if (button == "right") and (state == "up") then
        IsCardShop = true--- 
    end
end) 

That's what I mean
 
 
 
Is this also possible with the new code?
 
 
 
So I don't mean that if a button is pressed, the panel opens, but if a player clicks on a Ped, the panel opens.
 
 
 
Anyway, thanks for the code you sent, I'll try it later. and if everything is true, I have already solved the ped thing
 
 
 
local thePed = createPed(0, x, y, z)

addEventHandler("onClientClick", root, function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld)
    if (button == "right") and (state == "up") then
        if isElement(clickedWorld) and clickedWorld == thePed then
            IsCardShop = not IsCardShop
            removeEventHandler("onClientRender", root, Panel)
            if IsCardShop then
                addEventHandler("onClientRender", root, Panel)
            end
        end
    end
end)

here

Link to comment
2 hours ago, Firespider said:
I wrote this, but something doesn't work with then, it says an error code
 
 
unknown.png
addEventHandler("onClientClick", root,
  function(button,state)
    if IsCardShop then
      if ( button == "left" and state == "down" ) then
        if isMouseInPosition(sx*0.55, sy*0.47, sx*0.06, sy*0.05) then
        end
    end
end
end)

try this

There is something that, if it is not there, may not work

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

 

Link to comment

It must be available to turn on the button or press the divorce

Take this as a rule in the DX. If this is not available, the button will not work in any case

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
--------------
addEventHandler("onClientClick", root,
  function(button,state)
    if IsCardShop then
      if ( button == "left" and state == "down" ) then
        if isMouseInPosition(sx*0.55, sy*0.47, sx*0.06, sy*0.05) then
        end
    end
end
end)

It should be like this

try this

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...