..:D&G:.. Posted September 6, 2015 Share Posted September 6, 2015 Hello guys, I am making an insurance system and I want players to insert their details in a gui, and if they haven't, it should output an error, I really don't know what's wrong with this, it insures my vehicle even though I haven't put any details in... function sendInsuranceApplication(button, state) if (source==bInsur) and (button=="left") and (state=="up") then if guiGetText(tName) ~= "" or guiGetText(tSurName) ~= "" or guiGetText(tTel) ~= "" or guiGetText(tAddress) ~= "" then outputChatBox("INSURE VEHICLE!", 255, 0, 0) else outputChatBox("PUT DETAILS IN!", 255, 0, 0) return end end end Thanks. Link to comment
TAPL Posted September 6, 2015 Share Posted September 6, 2015 Replace 'or' with 'and'. Link to comment
..:D&G:.. Posted September 6, 2015 Author Share Posted September 6, 2015 Replace 'or' with 'and'. The thing is, I want the message to show when the player has not entered the details in 1 box, because I don't want to do an 'elseif' for every box... but still, it insures my vehicle, it doesn't say that I haven't entered the details.. Link to comment
Addlibs Posted September 6, 2015 Share Posted September 6, 2015 TAPL is right. Your IF criteria is made in such a way that if ANY of the aforementioned is filled out, it proceeds with the code. Changing all 'or' into 'and' would make it proceed if ALL of the aforementioned is filled out. Link to comment
..:D&G:.. Posted September 6, 2015 Author Share Posted September 6, 2015 TAPL is right. Your IF criteria is made in such a way that if ANY of the aforementioned is filled out, it proceeds with the code. Changing all 'or' into 'and' would make it proceed if ALL of the aforementioned is filled out. It makes no difference if I add 'or' or 'and' or even swap the outputChatBoxes, it still does the first thing before the 'else', even if the player entered nothing, or completed every form. 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