Jump to content

HELP: DX


Bilal135

Recommended Posts

I created a dx rectangle all over a screen, created some dx rectangles and added some dx text in them (as buttons). Then I created some buttons on the dx rectangles, and set their alpha to 0. Now I made them fully functional in script, but when I click them IG, the next GUI doesn't appear.

Here's how I created the buttons:

function buttons() 
        btn = guiCreateButton(430, 246, 218, 44, "", false, false, dx) 
        guiSetAlpha(btn, 0.00) 
        guiSetProperty(btn, "Alpha", "0.000000") 
  
  
        btn2 = guiCreateButton(430, 300, 218, 41, "", false, false, dx) 
        guiSetAlpha(btn2, 0.00) 
        guiSetProperty(btn2, "Alpha", "0.000000") 
end 

Here's how I created the dx:

function dx() 
        dxDrawRectangle(0, 0, 1366, 768, tocolor(51, 51, 51, 254), false) 
        dxDrawImage(664, 161, 378, 317, "images/mwmta.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
        dxDrawRectangle(431, 247, 217, 43, tocolor(0, 0, 0, 126), false) 
        dxDrawText("Multiplayer Campaign", 461, 257, 617, 280, tocolor(255, 255, 255, 255), 1.30, "default", "left", "top", false, false, false, false, false) 
        dxDrawRectangle(431, 300, 217, 41, tocolor(0, 0, 0, 126), false) 
        dxDrawText("Disconnect", 499, 310, 580, 329, tocolor(255, 255, 255, 255), 1.30, "default", "left", "top", false, false, false, false, false) 
    end 

Here's how I made the DX appear:

addEvent("onPlrLoginMan", true) 
addEventHandler("onPlrLoginMan", root, 
function() 
        addEventHandler("onClientRender", root, dx) 
        addEventHandler("onClientRender", root, buttons) 
end 
) 

Here's how I detect click and other things:

function onGuiClick() 
if ( source == btn ) then 
removeEventHandler("onClientRender", root, dx) 
removeEventHandler("onClientRender", root, buttons) 
triggerEvent("teamSelector", localPlayer) 
end 
if ( source == btn2 ) then 
kickPlayer(localPlayer, true) --My bad, I know this has to be done server sided. 
end 
end 
addEventHandler("onClientGUIClick", root, onGuiClick) 

Maybe its not detecting the click or maybe the button is created under the dx? But I remember I created it right on the dx rectangle. Any fix for this?

Thanks in advance.

Link to comment
function buttons() 
        btn = guiCreateButton(430, 246, 218, 44, "", false) 
        guiSetAlpha(btn, 0.00) 
        guiSetProperty(btn, "Alpha", "0.000000") 
  
  
        btn2 = guiCreateButton(430, 300, 218, 41, "", false) 
        guiSetAlpha(btn2, 0.00) 
        guiSetProperty(btn2, "Alpha", "0.000000") 
end 

So, now I removed "dx" thingy at the end of buttons, but it worked when I clicked all over the dx rectangle many times rapidly, and for once it really detected the click. But it doesn't happen always, mainly the problem is still there.

Any help regarding this or how can I detect the click?

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