Cronoss Posted February 10, 2022 Share Posted February 10, 2022 I made a button for a GUI, when the player presses it, the button triggers another GUI Panel, but I want to make sure the player complete all the comboBox items, how I could do it? A1 = guiComboBoxGetSelected(blabla) A2 = guiComboBoxGeItemText(A1) B1 = guiComboBoxGetSelected(blabla2) B2 = guiComboBoxGeItemText(B1) if (A2=="") or (B2=="") then --This doesn't work correctly, it only makes nothing happens after pressing the GUI button outputChatBox("You must... blablabla", 255, 0, 0, source) else triggerServerEvent("AwesomeFunction", getLocalPlayer(), A2, B2) end end, false) This is client side Link to comment
βurak Posted February 10, 2022 Share Posted February 10, 2022 1 hour ago, Cronoss said: I made a button for a GUI, when the player presses it, the button triggers another GUI Panel, but I want to make sure the player complete all the comboBox items, how I could do it? A1 = guiComboBoxGetSelected(blabla) A2 = guiComboBoxGeItemText(A1) B1 = guiComboBoxGetSelected(blabla2) B2 = guiComboBoxGeItemText(B1) if (A2=="") or (B2=="") then --This doesn't work correctly, it only makes nothing happens after pressing the GUI button outputChatBox("You must... blablabla", 255, 0, 0, source) else triggerServerEvent("AwesomeFunction", getLocalPlayer(), A2, B2) end end, false) This is client side try using string.len and string.gsub local text = "" -- empty text text = string.gsub(text, "%s+", "") -- delete all spaces if(string.len(text) > 0) then --if text is greater than 0 characters -- codes here end 1 Link to comment
Cronoss Posted February 10, 2022 Author Share Posted February 10, 2022 But how I could add it to the guiComboBoxGeItemText thing? Link to comment
βurak Posted February 10, 2022 Share Posted February 10, 2022 (edited) 14 minutes ago, Cronoss said: But how I could add it to the guiComboBoxGeItemText thing? There is no reason for you to do this check for the combo box, if you want to check it with the player's input, it may work, but I'll give an example anyway. A2 = string.gsub(A2, "%s+", "") -- delete all spaces for A2 if(string.len(A2) > 0) then --if A2 is greater than 0 characters -- codes here end you can only use this in variables where you use guiComboBoxGeItemText function Edited February 10, 2022 by Burak5312 Link to comment
Cronoss Posted February 10, 2022 Author Share Posted February 10, 2022 (edited) Quote There is no reason for you to do this check for the combo box I asked because I put the code, obviusly I tried to figure out how to make the "text" detect the combobox, but I didn't realize how. The code itself works, but I don't get how to make the "text" part get the player combobox item selected, because the "text" variable keeps with empty text Edited February 10, 2022 by Cronoss Link to comment
Cronoss Posted February 10, 2022 Author Share Posted February 10, 2022 (edited) Solved by my own, no need for more answers thank you anyway Burak! Edited February 10, 2022 by Cronoss 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