mob/admin/verb/ban(mob/m in world)
set category="Admin"
m.banned=1
var/savefile/F=new("Players/[ckey(m.key)].sav")
F["Banned"]<<m.banned
del m
world << "[m] has been banned."
login()
var/FileName="Players/[ckey(src.key)].sav"
if(fexists(FileName))
var/savefile/F=new(FileName)
F["Banned"]>>src.banned
if(src.banned)
alert("You are banned")
del src
Problem description: So I know how to ban someone using the above code but how can I possibly unban someone if they are not in the world because they're banned? I could create a world list but how do I save a world list?
Obviously, unless you hard-code this list in (which means a game update every time you want to unban someone), you'll have to add names to it at run-time, which means that it'll only work if the banned player tries to log in while that particular game session/server is running.
Alternatively, you could have bans only be semi-permanent, and "expire" after a certain number of days/weeks. To do this, you could set their "banned" var to world.realtime (instead of just 1), then on login, you could check the value against the current realtime to see how long ago they were first banned. If it is past your time limit, then unban them. (you'd need to do the math on the realtime difference to figure out how many days/weeks/whatever it has been)