Jump to content

[HELP] guiGetText problem


..:D&G:..

Recommended Posts

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 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...