ID:262524
 
mob/creating_character
Login()
var/list/BetaTesters=list("TheoXCMP")
if(usr.key in list)
usr<<"you are allowed!"
usr.loc=locate(7,7,5)
world << "[usr] Logs in."
usr << sound('7fiveyears.mid')
else
usr<<"bai!"
del usr
...()

Problem description:Im trying to make it so that only people i list can play the game, and all others are given a message then booted. When I compile this there is 1 error, and 1 warning. The error is inconsistent indentation and when i dbl clk the msg it highlight else. The warning states the the else clause is empty. Can someone please help me.

</<>
1 - Please put your code in DM tags. When typing code into the forums, put
 and
before and after the code, respectively. Without the space in the brackets. It makes it much easier to read code.

2 - Don't use usr in Login(), it isn't safe. Use src instead.

3 - The if and all code following it should be unindented one tab.

4 - The if check should be
 if(key in BetaTesters)
.

5 - The ...() at the end of the code should be ..(). ...() doesn't exist, I'm afraid.

6 - I suggest you read the BYOND guide, here: http://www.byond.com/docs/guide/. That will help you learn to program in DM.
In response to Jp
Login()
var/list/betatester=list("TheoXCMP")
if(usr.key in betatester)
usr<<"You are allowed"
usr.loc=locate(7,7,5)
world<<"[usr] logs in"
usr << sound('7fiveyears.mid')
else
usr<<"Bai!"
del(usr)
..()



You were telling it to look in list, rather then betatester, which is what you defined it as