ID:268116
 
if(usr.key == "Lightning_Baby_Zero"||"Kasumi Tomonari")
usr.GameAdmin = 1
else
usr<<"Only game administer are allowed to enter the testing! You may stay, but you will go into a alpha testing room."
usr.loc = locate(5,5,1)

When people login, it makes all of them administers... even the people that arnt in the list..

Kasumi Tomonari wrote:
if(usr.key == "Lightning_Baby_Zero"||"Kasumi Tomonari")
usr.GameAdmin = 1
else
usr<<"Only game administer are allowed to enter the testing! You may stay, but you will go into a alpha testing room."
usr.loc = locate(5,5,1)

When people login, it makes all of them administers... even the people that arnt in the list..


Is that the whole Login() code? If not, give us the whole.

And please, use

<dm> Tags


While posting a code on the forum.



--SSJ4_Gohan_Majin
Kasumi Tomonari wrote:
if(usr.key == "Lightning_Baby_Zero"||"Kasumi Tomonari")
usr.GameAdmin = 1
else
usr<<"Only game administer are allowed to enter the testing! You may stay, but you will go into a alpha testing room."
usr.loc = locate(5,5,1)

When people login, it makes all of them administers... even the people that arnt in the list..

You're checking if(usr.key == "Lightning_Baby_Zero") as well as checking if("Kasumi Tomonari"). Since Kasumi Tomonari is string with content, it will always return true. What you want is if(usr.key == "Lightning_Baby_Zero" || usr.key == "Kasumi Tomonari")
In response to SSJ4_Gohan_Majin
mob/Login()
if(usr.key == "Lightning_Baby_Zero"||"Kasumi Tomonari")
usr.GameAdmin = 1
else
usr<<"<B>Only game administer are allowed to enter the testing! You may stay, but you will go into a alpha testing room.</B>"
usr.loc = locate(5,5,1)
..()
In response to Jon88
Jon88 wrote:
What you want is if(usr.key == "Lightning_Baby_Zero" || usr.key == "Kasumi Tomonari")

Even better:
if (src.key in list("Lightning_Baby_Zero","Kasumi Tomonari"))


And even better than that, create a separate hub entry for game admins. Call it whatever you want, MyGameAdmins or anything. Set it up under distribution by invitation only. Make a note of the passport string it gives you, and then use the following in your game code:
if (src.client.CheckPassport("yourpassportstringhere"))
src.GameAdmin = 1
else
// only game admins may ... blah blah blah


With this method, you never have to recompile your game to add or remove admins. Just go to the distribution tab of that hub entry and add/subtract people. Much, much cleaner, especially after you start to distribute it!
In response to Kasumi Tomonari
Kasumi Tomonari wrote:
> mob/Login()
> if(usr.key == "Lightning_Baby_Zero"||usr.key == "Kasumi Tomonari")
> usr.GameAdmin = 1
> else
> usr<<"<B>Only game administer are allowed to enter the testing! You may stay, but you will go into a alpha testing room.</B>"
> usr.loc = locate(5,5,1)
> ..()
>



Revised code above.

[Edit]
Or, you can do it this way.

var/list/admins = list("Lightning_Baby_Zero","Kasumi Tomonari")

mob
Login()
..()
if(admins.Find(usr.key))
usr.GameAdmin = 1
else
usr<<"Only game administer are allowed to enter the testing! You may stay, but you will go into a alpha testing room."
usr.loc = locate(5,5,1)


It's much easier, just add "key". It's pretty hard to get a bug that way.

--SSJ4_Gohan_Majin