KillerNico Posted April 13, 2011 Posted April 13, 2011 Hi all I want to make a GUI: addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Window[1] = guiCreateWindow(782,176,240,493,"Alarm Menu",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Button[1] = guiCreateButton(108,210,5,5,"",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(22,56,196,55,"Stufe 5",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(22,128,198,56,"Stufe 4",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(23,201,197,55,"Stufe 3",false,GUIEditor_Window[1]) GUIEditor_Button[5] = guiCreateButton(22,274,198,56,"Stufe 2",false,GUIEditor_Window[1]) GUIEditor_Button[6] = guiCreateButton(22,344,199,57,"Stufe 1",false,GUIEditor_Window[1]) GUIEditor_Button[7] = guiCreateButton(131,425,87,38,"Abbruch",false,GUIEditor_Window[1]) GUIEditor_Button[8] = guiCreateButton(24,425,86,38,"Info (Chatbox)",false,GUIEditor_Window[1]) end ) So how i can add functions to the Buttons ??
Castillo Posted April 13, 2011 Posted April 13, 2011 GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Window[1] = guiCreateWindow(782,176,240,493,"Alarm Menu",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Button[1] = guiCreateButton(108,210,5,5,"",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(22,56,196,55,"Stufe 5",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(22,128,198,56,"Stufe 4",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(23,201,197,55,"Stufe 3",false,GUIEditor_Window[1]) GUIEditor_Button[5] = guiCreateButton(22,274,198,56,"Stufe 2",false,GUIEditor_Window[1]) GUIEditor_Button[6] = guiCreateButton(22,344,199,57,"Stufe 1",false,GUIEditor_Window[1]) GUIEditor_Button[7] = guiCreateButton(131,425,87,38,"Abbruch",false,GUIEditor_Window[1]) GUIEditor_Button[8] = guiCreateButton(24,425,86,38,"Info (Chatbox)",false,GUIEditor_Window[1]) function buttonClicks() if (source == GUIEditor_Button[1]) then outputChatBox("You have pressed the button 1") elseif (source == GUIEditor_Button[2]) then outputChatBox("You have pressed the button 2") end end addEventHandler("onClientGUIClick",getRootElement(),buttonClicks)
KillerNico Posted April 13, 2011 Author Posted April 13, 2011 Thank You Ps: 2nd Question: How i can close the gui ??
Castillo Posted April 13, 2011 Posted April 13, 2011 Well, you must add another button or a command, command example of how to do it: addCommandHandler("close", function () guiSetVisible(GUIEditor_Window[1],false) showCursor(false) end)
KillerNico Posted April 13, 2011 Author Posted April 13, 2011 Ok if you want: I want to play Musik on Command "alarm", its .mp3 ! Ps.: Its ca. 30 saconds long
Castillo Posted April 13, 2011 Posted April 13, 2011 Well, firstly you need to add it to meta.xml, and then you use this: playSound("alarm.mp3",false)
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