Yazir Posted January 29, 2017 Share Posted January 29, 2017 (edited) Hello! I'm getting a grip on Event system and I can't make "onClientGuiClick" work. I'd be very grateful if anyone could help me. addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), function() marketwindow = guiCreateWindow(428, 238, 1046, 562, "Overload Market", false) guiWindowSetSizable(marketwindow, false) guiSetAlpha(marketwindow, 0.85) listMarket = guiCreateGridList(538, 42, 492, 397, false, marketwindow) guiGridListAddColumn(listMarket, "Item", 0.3) guiGridListAddColumn(listMarket, "Owner", 0.3) guiGridListAddColumn(listMarket, "Cost", 0.3) listEq = guiCreateGridList(10, 42, 492, 397, false, marketwindow) guiGridListAddColumn(listEq, "Item", 0.9) placeItemButton = guiCreateButton(10, 504, 185, 48, "Place item on market", false, marketwindow) buyItemButton = guiCreateButton(845, 449, 185, 48, "Buy item from market", false, marketwindow) priceMemo = guiCreateMemo(75, 456, 120, 38, "", false, marketwindow) priteLabel = guiCreateLabel(10, 456, 185, 38, "Set price", false, marketwindow) guiSetFont(priteLabel, "default-bold-small") guiSetProperty(priteLabel, "Size", "w:0.176864 h:0.067616") guiLabelSetVerticalAlign(priteLabel, "center") closeButton = guiCreateButton(970, 524, 60, 28, "Close", false, marketwindow) --guiSetVisible( marketwindow, false ) showCursor( true, true ) addEventHandler ( "onClientGuiClick", closeButton, onClientGuiClickHandler) end) function toggleMarket() if guiGetVisible(marketwindow) == false then showCursor( true, true ) guiSetVisible( marketwindow, true ) else showCursor( false, false ) guiSetVisible( marketwindow, false ) end end addCommandHandler( "market", toggleMarket) function onClientGuiClickHandler( button ) outputChatBox( "hoi" ) -- this doesn't even run end Edited January 29, 2017 by Yazir Link to comment
mint3d Posted January 29, 2017 Share Posted January 29, 2017 (edited) addEventHandler ( "onClientGUIClick", closeButton, onClientGuiClickHandler, false ) --Replace line 23 with that ^ Edited January 29, 2017 by mint3d 1 Link to comment
Yazir Posted January 29, 2017 Author Share Posted January 29, 2017 Oh, I see my mistake. Gui instead of GUI... In moments like this I lose faith in myself. Thanks alot! 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now