Jump to content




<eof> expected


  • You cannot reply to this topic
4 replies to this topic

#1 TigerMeister

  • New Members
  • 2 posts

Posted 23 March 2017 - 03:43 PM

Hello. I am trying to code an door lock for Tekkit classic and I cant just figure it out.


Its an username + password lock and I am trying to fix an master password.

Spoiler

Any ideas on what I should do? And can I improve something?

#2 FuzzyLitchi

  • Members
  • 34 posts

Posted 23 March 2017 - 08:07 PM

If you want TigerMeister and Tigernr2 to be passwords and usernames you have to use them as string. Use this
master = "TigerMeister"
password = "Tigernr2"

Also instead of
if master == password then
you should compare user to master and pass to password as so
if user == master and pass == password then

Using more descriptive variable names such as master_username, master_password, read_user, read_password can ensure that these types of errors don't happen :)

If you have any other errors, please write down the error line number and message, or explain what happens :)

Edited by FuzzyLitchi, 23 March 2017 - 08:10 PM.


#3 valithor

  • Members
  • 1,053 posts

Posted 23 March 2017 - 10:14 PM

Your if elseif structure is misformed, which is what is causing the oef error. Right now with all the code between the if statements removed this is what the structure looks like.

if master == password then

else
  if tUsers[user] == pass then
  end
else

end

Notice that I indented the code to make it to where the beginning of a block lines up with the close of the block. In this code there are multiple else statements which correspond to that first if, which is not allowed in almost all languages. You probably meant to do something like this:

if master == password then

elseif tUsers[user] == pass then

else

end

Notice that I changed the first else to a elseif, which makes it to where there is only a single else to the if statement.

#4 TigerMeister

  • New Members
  • 2 posts

Posted 24 March 2017 - 05:04 PM

Thanks for help guys.

#5 FuzzyLitchi

  • Members
  • 34 posts

Posted 24 March 2017 - 09:12 PM

You're welcome :D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users