ID:159848
 
I was thinking about making a time-ban for my game, but I don't know exactly how to make it.
I thought on something like this...

mob
Police
verb
Key_Ban(mob/M in world)
set category = "Police"
set desc = "Key ban a player from the world."
if(!M) return
if(M.client)
var/X = input(usr, "Time") as num
Bans:Add(M.key)
Bans[M.key]="[M.client.address]"
del(M)
sleep(X)
Bans:Remove(M.key)
else
usr<<"You cant ban npc's."
Seems good, Two ways you can do this
1) Make it where It reads the day the person is banned, and make it where so and so has to put the date where he's unbanned, and every time client/New() occurs, make it check the date. and if it's his unban date, Unban.

2)Enable sleep_offline(See DM Ref)
What if the game goes down in the middle of a ban?
In response to Mizukouken Ketsu
That's why you have sleep_offline?
In response to World Build
You apparently don't know what sleep_offline does. Lok it up in F1/the reference.

If the game goes down in the middle of a ban, what's there to continue the ban sleep timer when it goes back up?
Time-measuring details aside, you shouldn't be using the colon operator when adding the key to the ban list... If using . doesn't work, you have the list defined wrong.
In response to Mizukouken Ketsu
Yeah, that's what I was thinking about...
I guess there isn't a way to make the code work exactly the way I want, right?
Your ban is very inefficient and will never work. First to start off with, when you ban someone you want them banned for a long period of time (sleep will not do that). If you plan on banning them for a given period then I suggest using DD Ban and setting the time.
In response to Yash 69
If he's not hosting the game, your wrong. ^-^
In response to Yash 69
So, how should I do it?