Jump to content

Can someone help me with my GUI


xXMADEXx

Recommended Posts

Hey guys... I have a GUI that i made, and the bindKey will not work for some reason, feel free to take a look at it:

GUIEditor_Window = {} 
GUIEditor_TabPanel = {} 
GUIEditor_Tab = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
  
GUIEditor_Window[1] = guiCreateWindow(62,60,1549,931,"US-RP (United States Roleplay)",false) 
guiSetAlpha(GUIEditor_Window[1],1) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
  
GUIEditor_Label[1] = guiCreateLabel(20,23,1502,153,"\n\nWelcome to United States Roleplay, where roleplay is made!\n\nThis is a 100% unique server! You can not find servers like this anywhere exept for here. We have the best staff, and the best scripts.\n\nPLEASE BE SURE TO READ ARE RULES SO YOU ARE NOT AT RISK OF BEING JAILED/MUTED/KICKED/BANNED!!!!!",false,GUIEditor_Window[1]) 
guiLabelSetHorizontalAlign(GUIEditor_Label[1],"center",true) 
  
GUIEditor_TabPanel[1] = guiCreateTabPanel(293,278,991,475,false,GUIEditor_Window[1]) 
  
GUIEditor_Tab[1] = guiCreateTab("About us",GUIEditor_TabPanel[1]) 
  
GUIEditor_Label[2] = guiCreateLabel(14,16,964,422,"First of all, we are the best server of ALL OF MTA AND SA-MP (SA-MP is shit)\n\nxXMADEXx (server owner) got sick of trying to find a new favorite server after being banned from is favorite one (RRC:RPG) for talking back to an admin.\n\n(He was talking back because the admin was being racist to Americans, his name is Khalil so give him shit if you want to! We encourage you to give him a hard time)\n\nAnyway, this server was developed in 2012, and was releast to public (IDK).\n\n",false,GUIEditor_Tab[1]) 
guiLabelSetColor(GUIEditor_Label[2],0,100,255) 
guiLabelSetHorizontalAlign(GUIEditor_Label[2],"center",false) 
guiSetFont(GUIEditor_Label[2],"clear-normal") 
  
GUIEditor_Tab[2] = guiCreateTab("Rules",GUIEditor_TabPanel[1]) 
  
GUIEditor_Tab[3] = guiCreateTab("Staff",GUIEditor_TabPanel[1]) 
  
button = guiCreateButton(300,773,979,143,"Exit Menu!",false,GUIEditor_Window[1]) 
guiSetFont(button,"sa-gothic") 
  
  
bindKey("F1", "down", 
function () 
guiSetVisible(GUIEditor_Window[1], true) 
guiSetVisible(GUIEditor_Label[1], true) 
guiSetVisible(GUIEditor_Label[2], true) 
guiSetVisible(GUIEditor_TabPanel[1], true) 
guiSetVisible(GUIEditor_Tab[1], true) 
guiSetVisible(GUIEditor_Tab[2], true) 
guiSetVisible(GUIEditor_Tab[3], true) 
guiSetVisible(button, true) 
showCursor (true) 
end 
  
function closed() 
guiSetVisible(GUIEditor_Window[1], false) 
guiSetVisible(GUIEditor_Label[1], false) 
guiSetVisible(GUIEditor_Label[2], false) 
guiSetVisible(GUIEditor_TabPanel[1], false) 
guiSetVisible(GUIEditor_Tab[1], false) 
guiSetVisible(GUIEditor_Tab[2], false) 
guiSetVisible(GUIEditor_Tab[3], false) 
guiSetVisible(button, false) 
showCursor (false, false) 
end 
addCommandHandler("closemenu", closed) 

Link to comment
bindKey ( "F1", "down", 
    function ( ) 
        guiSetVisible(GUIEditor_Window[1], true) 
        guiSetVisible(GUIEditor_Label[1], true) 
        guiSetVisible(GUIEditor_Label[2], true) 
        guiSetVisible(GUIEditor_TabPanel[1], true) 
        guiSetVisible(GUIEditor_Tab[1], true) 
        guiSetVisible(GUIEditor_Tab[2], true) 
        guiSetVisible(GUIEditor_Tab[3], true) 
        guiSetVisible(button, true) 
        showCursor (true) 
    end 
)-- You had a missing parentheses here. 

Read the comment.

Link to comment
bindKey ( "F1", "down", 
    function ( ) 
        guiSetVisible(GUIEditor_Window[1], true) 
        guiSetVisible(GUIEditor_Label[1], true) 
        guiSetVisible(GUIEditor_Label[2], true) 
        guiSetVisible(GUIEditor_TabPanel[1], true) 
        guiSetVisible(GUIEditor_Tab[1], true) 
        guiSetVisible(GUIEditor_Tab[2], true) 
        guiSetVisible(GUIEditor_Tab[3], true) 
        guiSetVisible(button, true) 
        showCursor (true) 
    end 
)-- You had a missing parentheses here. 

Read the comment.

Tried it, it still wont show D:

Link to comment
  • MTA Team

Your code has so much unnecessary things and small things to edit. Here you go. Should work perfectly fine, I don't see any errors as I have done the same code myself quite many times. If it doesn't work, make sure the resource is running, meta.xml is set and the script has been defined client-side. Perhaps give us your /debugscript 3 details if it still doesn't work.

Client-side

bindKey("F1", "down", 
    function() 
        if not isElement(GUIEditor_Window[1]) then 
            -- GUI Tables 
            GUIEditor_Window = {} 
            GUIEditor_TabPanel = {} 
            GUIEditor_Tab = {} 
            GUIEditor_Button = {} 
            GUIEditor_Label = {} 
             
            -- GUI Window 
            GUIEditor_Window[1] = guiCreateWindow(62, 60, 1549, 931, "US-RP (United States Roleplay)", false) 
            guiSetAlpha(GUIEditor_Window[1], 1) 
            guiWindowSetMovable(GUIEditor_Window[1], false) 
            guiWindowSetSizable(GUIEditor_Window[1], false) 
            showCursor(true) 
             
            -- GUI Label 
            GUIEditor_Label[1] = guiCreateLabel(20, 23, 1502, 153, "\n\nWelcome to United States Roleplay, where roleplay is made!\n\nThis is a 100% unique server! You can not find servers like this anywhere exept for here. We have the best staff, and the best scripts.\n\nPLEASE BE SURE TO READ ARE RULES SO YOU ARE NOT AT RISK OF BEING JAILED/MUTED/KICKED/BANNED!!!!!", false, GUIEditor_Window[1]) 
            guiLabelSetHorizontalAlign(GUIEditor_Label[1], "center", true) 
             
            -- GUI Tabs 
            GUIEditor_TabPanel[1] = guiCreateTabPanel(293, 278, 991, 475, false, GUIEditor_Window[1]) 
            GUIEditor_Tab[1] = guiCreateTab("About us", GUIEditor_TabPanel[1]) 
            GUIEditor_Tab[2] = guiCreateTab("Rules", GUIEditor_TabPanel[1]) 
            GUIEditor_Tab[3] = guiCreateTab("Staff", GUIEditor_TabPanel[1]) 
             
            -- GUI Label 
            GUIEditor_Label[2] = guiCreateLabel(14, 16, 964, 422, "First of all, we are the best server of ALL OF MTA AND SA-MP (SA-MP is :~)\n\nxXMADEXx (server owner) got sick of trying to find a new favorite server after being banned from is favorite one (RRC:RPG) for talking back to an admin.\n\n(He was talking back because the admin was being racist to Americans, his name is Khalil so give him :~ if you want to! We encourage you to give him a hard time)\n\nAnyway, this server was developed in 2012, and was releast to public (IDK).\n\n", false, GUIEditor_Tab[1]) 
            guiLabelSetColor(GUIEditor_Label[2], 0, 100, 255) 
            guiLabelSetHorizontalAlign(GUIEditor_Label[2], "center", false) 
            guiSetFont(GUIEditor_Label[2], "clear-normal") 
             
            -- GUI Button 
            button = guiCreateButton(300, 773, 979, 143, "Exit Menu!", false, GUIEditor_Window[1]) 
            guiSetFont(button, "sa-gothic") 
             
            -- GUI events 
            addEventHandler("onClientGUIClick", button, function() destroyElement(GUIEditor_Window[1]) showCursor(false) end, false) 
        else 
            destroyElement(GUIEditor_Window[1]) 
            showCursor(false) 
        end 
    end 
) 

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