ChaseOquinn Posted July 21, 2011 Share Posted July 21, 2011 Hey I'm having some problems with combo boxes. here's some of the code. window = guiCreateWindow(x/2 - -100,y/2 - 110,280,310,"World",false) label7 = guiCreateLabel(10,180,80,40,"Reset Colors:",false,window) box2 = guiCreateComboBox(100,180,60,90,"Sky",false,window) guiComboBoxAddItem(box2,"Sky") guiComboBoxAddItem(box2,"Water") guiComboBoxAddItem(box2,"Sun") function resetColors() if (source == button13) then if guiComboBoxGetSelected(box2) == -1 or 0 then resetSkyGradient() if guiComboBoxGetSelected(box2) == 1 then resetWaterColor() if guiComboBoxGetSelected(box2) == 2 then resetSunColor() end end end end end addEventHandler("onClientGUIClick",button13,resetColors) The problem is if I select Sky it resets the Sky, but if i select Water and the Sky color is changed it will still reset the Sky, but it wont reset the water color. If i select Sun nothing resets. I believe the problem is with the item indexes. Link to comment
Aibo Posted July 21, 2011 Share Posted July 21, 2011 your conditions are wrong: window = guiCreateWindow(x/2 - -100,y/2 - 110,280,310,"World",false) label7 = guiCreateLabel(10,180,80,40,"Reset Colors:",false,window) box2 = guiCreateComboBox(100,180,60,90,"Sky",false,window) guiComboBoxAddItem(box2,"Sky") guiComboBoxAddItem(box2,"Water") guiComboBoxAddItem(box2,"Sun") function resetColors() if (source == button13) then if guiComboBoxGetSelected(box2) == -1 or guiComboBoxGetSelected(box2) == 0 then resetSkyGradient() elseif guiComboBoxGetSelected(box2) == 1 then resetWaterColor() elseif guiComboBoxGetSelected(box2) == 2 then resetSunColor() end end end addEventHandler("onClientGUIClick",button13,resetColors) PS: x/2 - -100 == x/2 + 100 Link to comment
ChaseOquinn Posted July 21, 2011 Author Share Posted July 21, 2011 Hey Aibo thank's for the help. And I seen a video u made on some new dx functions and shaders. Nice job on that. 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