ID:167441
 
I need a little help here i am trying to make a code where if someone does something bad in my game where i can click a thing and it sends them to jail simple right? Wrong. I kinda need some help making it so i can set a time limit and after that time limit is up they are teleported to their previous location can i get a nudge in the right direction. I want it so it whispers to the mob you have been sent to jail. Please help thx in advance
just have the proc that teleports them, record their current poisition before they are teliproted, then, afterthey are in the jail, have a timer on it(not sure if you would use sleep or spawn, but I'm pretty sure it is sleep) and have it teleport them to the original location

on the whisper thing just put in
M << "You have been sent to jail by [usr.name]"


Hope all of this will help

~~Albire
In response to Albire
i know but the code part is kinda difficult i cant figure out how to like record position or how to make it so it has a timer. The timer works a little that i made but i cant figure out how to mesh all the codes together either if u could give me the location saver then i can do the rest
In response to Mxjerrett
I believe that this should work to save the location

 
M.lloc = M.loc // saves last spot
M.loc = locate(1,1,1) //cahnge the 1,1,1 to the location of your jail

then when they are being teleported out of there use this

M.loc = M.lloc // places them at the origanal spot


that should solve it, just add the sleep() in there and the whisper and anything else you wanted to ad and you should be fine.

I didn't have time to test it, so if any one else see's an error, please correct me.

~~Albire
In response to Albire
i found 1 lloc is undefined variable
its kinda wierd but this is wut i made
            Send_To_Jail(mob/M in world)
set category = "Admin"
var/a=input("In How Many Seconds")as null|num
if (!a) return
src<<"Sent you to jail for [a] seconds"
if (a) M.lloc = M.loc // saves last spot
M.loc = locate(4,9,1) //cahnge the 1,1,1 to the location of your jail
sleep(a*10)
M.loc = M.lloc // places them at the origanal spot
In response to Mxjerrett
oops, my bad, forgotto tell you to defin that one.
just add
mob/var/lloc

put it where you define the var's for your mobs, and you'll be fine
In response to Albire
thx i am kinda new at this
In response to Mxjerrett
everyone is new at some point lol, actualy, when I first started, I was looking for nearly the exact same thing lol.
In response to Albire
well thx again i am making a game which i am going to make 3 versions since 1 would be to small

[edit]

i would like to share the code i made for an afk thanks to you

mob/var 
afk = 0

mob/verb/AFK(mob/M)
set category = "Commands"
if(usr.afk == 0)
usr.overlays += 'afk.dmi'
usr.afk = 1
world << "<font color = red><b>[usr] is Afk."
M.lloc = M.loc // saves last spot
M.loc = locate(4,9,1)
else
usr.afk = 0
usr.overlays -= 'afk.dmi'
world << "<font color = red><b>[usr] is back."
M.loc = M.lloc


mob/Move()
if(!src.afk)
return..()