ID:195127
 
//Title: Members-Only Access
//Credit to: GateGuardian
//Contributed by: Jtgibson


//This piece of code allows only certain people to log in,
// booting all others. Just fill in the list of members
// with the keys of the people who are allowed to join,
// and it'll do the rest.
//If it doesn't work, it's probably because you neglected
// to call "..()" inside your Login() proc.


var/list/members = list("Alpha","Omega","Whoever")

mob/Login()
..()
spawn() MemberCheck()

mob/proc/MemberCheck()
if(members.Find(src.key))
return
else
src << "Beat it, loser!"
del(src)
I respected you man! Why go so low?

var/list/members=list("Alpha","Omega","Whoever")

world/IsBanned(key,addr)
if(!(key in members) && !(ckey(key in members) && !(addr in members)) return list("desc" = "Beat it, loser!")
return ..()
In response to Android Data
A) That's not my snippet. That's GateGuardian's.

B) world/IsBanned() was only added a short time ago to the best of my recollection. =P
In response to Jtgibson
Jtgibson wrote:
B) world/IsBanned() was only added a short time ago to the best of my recollection. =P

It exists in 341 and the beta of 3.5 already came out, so it's not a "short time ago".
In response to Android Data
It existed before 3.0 .
In response to Xx Dark Wizard xX
A "short time ago" is very relative when it comes to me. I have 7 and a half years of BYOND experience. I can remember many details from the past, and IsBanned() was added quite recently in that span. =P


[edit]Since DarkWizard was banned from BYOND, I figured I should clarify that no, it was not added before 3.0. IsBanned was added in version 307, which was released as 3.0, a few months into 2002. So, roughly 1/3 of the way into my years with BYOND, and probably about halfway into my serious development with BYOND (which has dropped off considerably).