DermaButton.DoClick = function ()
if(Name:GetValue() == "" or Pass:GetValue() == "") then
RunConsoleCommand("adduserdb", Name:GetValue(), Pass:GetValue(),"fgfdghfgkuilu")
i dont get a error…
i want it to check if any of this 2 fielads is empty Name and pass if they it wont do anything…
You dont need that else there, what your doing currently is making it so if their name or pass equals nothing then do nothing, if it equals something then you are trying to run the adduserdb command…Also I think your arguments for RunConsoleCommand have to be In quotation marks
if(Name:GetValue() == “” or Pass:GetValue() == “”) then
else – This doesn’t need to be here
RunConsoleCommand(“adduserdb”, Name:GetValue(), Pass:GetValue(),“fgfdghfgkuilu”)
His point was that he didn’t want it to do anything if they both were empty strings, in which case his code was logically valid, but bad practise in my experience.
Due to De Morgan’s Law you can replace the empty statement with the logical inversion of the condition. So
[lua]if(Name:GetValue() == “” or Pass:GetValue() == “”) then
[lua]if(Name:GetValue() ~= “” and Pass:GetValue() ~= “”) then[/lua]
You also don’t need to put quotation marks around your values if you use the RunConsoleCommand function.
I’m assuming that Name and Pass are defined earlier in the code, otherwise the function closiure wouldn’t work.
To work out what’s going wrong when you press the button I’d put this at the beginning.
MsgN("Name: ", Name:GetValue(), " Pass: ", Pass:GetValue(), "
") so it will print to your console what the values were, this should help you debug.