Jump to content

Why doesnt this button work


tim260

Recommended Posts

  
 local gui = {} 
    gui._placeHolders = {} 
      
    local screenWidth, screenHeight = guiGetScreenSize() 
    local windowWidth, windowHeight = 842, 498 
    local left = screenWidth/2 - windowWidth/2 
    local top = screenHeight/2 - windowHeight/2 
    
    gui["_root"] = guiCreateWindow(left, top, windowWidth, windowHeight, "United States Customs & Border Protection", false) 
    guiWindowSetSizable(gui["_root"], false) 
    guiSetVisible(gui["_root"], false) 
    
    gui["tabWidget"] = guiCreateTabPanel(0, 75, 821, 431, false, gui["_root"]) 
    
    gui["tab"] = guiCreateTab("Red County", gui["tabWidget"]) 
    
    gui["test"] = guiCreateButton( 10, 10, 401, 361, "Output!", false, gui["tab"] ) 
  
    
    gui["label_2"] = guiCreateLabel(460, 90, 271, 221, "", false, gui["tab"]) 
    guiLabelSetHorizontalAlign(gui["label_2"], "left", false) 
    guiLabelSetVerticalAlign(gui["label_2"], "center") 
    
    gui["tab_3"] = guiCreateTab("Montomery Intersection", gui["tabWidget"]) 
  
     gui["plainTextEdit"] = guiCreateMemo(10, 10, 401, 361, "Toll 1 open close : mitoll1(c) \n\nToll2 open close : mitoll2(c) \n\nAll open close : miall(c) \n\n**(c) if theres a c behind command its for close**\n\n**Commands are not to abuse abuse = kick**", false, gui["tab_3"]) 
    guiMemoSetReadOnly(gui["plainTextEdit"], true) 
    
    gui._placeHolders["line"] = {left = 27, top = 180, width = 751, height = 20, parent = gui["tab_3"]} 
    
    gui["tab_2"] = guiCreateTab("Members", gui["tabWidget"]) 
    
    gui["label"] = guiCreateLabel(290, 25, 411, 31, "", false, gui["_root"]) 
    guiLabelSetHorizontalAlign(gui["label"], "left", false) 
    guiLabelSetVerticalAlign(gui["label"], "center") 
    
function OpenClose() 
if guiGetVisible(gui["_root"]) == true then 
guiSetVisible(gui["_root"], false) 
showCursor(false) 
elseif guiGetVisible(gui["_root"]) == false then 
guiSetVisible(gui["_root"], true) 
showCursor(true) 
end 
end 
addCommandHandler ( "toll", OpenClose ) 
  
function outputEditBox () 
executeCommandHandler ( "hptoll2c" ) 
end 
addEventHandler ( "onClientGUIClick", gui["test"] ) 

why doesnt the button "test" work

Link to comment
  
addEventHandler("onClientGUIClick", getRootElement(), 
function() 
    if(source == gui["test"])then 
        executeCommandHandler("hptoll2c") 
    end 
end) 
  

Edit: the command "hptoll2c" exist?

it does ill send the thing later in a edit

function createTheGate25 () 
     myGate25 = createObject ( 968, 2881.6000976563, -682.59997558594, 10.69999980926, 0, 270, 359.74743652344 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate25 ) 
  
function openMyGate25() 
   moveObject ( myGate25, 3000, 2881.6000976563, -682.59997558594, 10.69999980926, 0, -90, 0 ) 
end 
addCommandHandler("hptoll2c", getRootElement(), openMyGate25) 
  
  
function movingMyGateBack25 () 
  moveObject ( myGate25, 3000, 2881.6000976563, -682.59997558594, 10.69999980926, 0, 90, 0 ) 
end 
addCommandHandler("hptoll2", movingMyGateBack25) 

Link to comment
  
addEventHandler("onClientGUIClick", getRootElement(), 
function() 
    if(source == gui["test"])then 
        executeCommandHandler("hptoll2c") 
    end 
end) 
  

Edit: the command "hptoll2c" exist?

it does ill send the thing later in a edit

function createTheGate25 () 
     myGate25 = createObject ( 968, 2881.6000976563, -682.59997558594, 10.69999980926, 0, 270, 359.74743652344 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate25 ) 
  
function openMyGate25() 
   moveObject ( myGate25, 3000, 2881.6000976563, -682.59997558594, 10.69999980926, 0, -90, 0 ) 
end 
addCommandHandler("hptoll2c", getRootElement(), openMyGate25) 
  
  
function movingMyGateBack25 () 
  moveObject ( myGate25, 3000, 2881.6000976563, -682.59997558594, 10.69999980926, 0, 90, 0 ) 
end 
addCommandHandler("hptoll2", movingMyGateBack25) 

someone know the solution ? :$
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...