ID:167428
 
ok i have two codes 1 sends you to jail and 1 makes u afk. I am trying to make it if u are in jail u cant go afk.

afk
mob/var //vars needed to work verbs in the game
afk = 0

mob/verb/AFK(mob/M)
set category = "Commands"

if(usr.afk == 0)
usr.overlays += 'afk.dmi' //overlays means it will go on top of your mob underlays will go behind your mob...
usr.afk = 1
world << "<font color = red><b>[usr] is Afk." //goes to everyone in the game..
M.lloc = M.loc // saves last spot
M.loc = locate(4,9,1) //cahnge the 1,1,1 to the location of your jail
else
usr.afk = 0
usr.overlays -= 'afk.dmi' //afk.dmi means the whole icon
world << "<font color = red><b>[usr] is back."
M.loc = M.lloc // places them at the origanal spot





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



jail
            Send_To_Jail(mob/M in world)
set category = "Admin"
var/a=input("In How Many Seconds")as null|num
if (!a) return
M <<"[usr.name] 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
I suggest learning how to program. No offense intended, but this is really easy. A way involves creating a boolean mob var, changing it when they are un/jailed, and checking the var when the player tries to go AFK.
In response to Artekia
i have tried something like in my afk if you are in jail it returns as 1 and it wont let u
In response to Mxjerrett
A more detailed explanation: create a mob var called Jailed, set this variable to 1 when the player is jailed, 0 when they are sent back, and check if(usr.Jailed) in the AFK verb. Put a return 0 under if(usr.Jailed). If the usr's Jailed variable is 1, then if(usr.Jailed) will go through and return 0 will stop the verb.
In response to Artekia
i tried something but it aint working so i no this is a newbish post but i really need a simple example thats how i learn
In response to Mxjerrett
Hey, not even I can do that :P
In response to Mxjerrett
Pseudo code example:
Declare mob var "Jailed"
AFK Verb
if Jailed is true
stop the verb
do normal AFK stuff

Jail Verb
set Jailed to true
do normal Jail stuff
set Jailed to false
> mob/var //vars needed to work verbs in the game
> afk = 0
jail = 0
> mob/verb/AFK(mob/M)
> set category = "Commands"
> if(usr.jail)return
> if(!usr.afk)
> usr.overlays += 'afk.dmi' //overlays means it will go on top of your mob underlays will go behind your mob...
> usr.afk = 1
> world << "<font color = red><b>[usr] is Afk." //goes to everyone in the game..
> M.lloc = M.loc // saves last spot
> M.loc = locate(4,9,1) //cahnge the 1,1,1 to the location of your jail
> else
> usr.afk = 0
> usr.overlays -= 'afk.dmi' //afk.dmi means the whole icon
> world << "<font color = red><b>[usr] is back."
> M.loc = M.lloc // places them at the origanal spot
>
>
>
>
>
> mob/Move()
> if(!src.afk)
> return..()
>

jail
>           Send_To_Jail(mob/M in world)
> set category = "Admin"
> var/a=input("In How Many Seconds")as null|num
> if (!a) return
> M <<"[usr.name] sent you to jail for [a] seconds"
> if (a) M.lloc = M.loc // saves last spot
> M.loc = locate
M.jail = 1
(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 Artekia
i made a variable called jail but i cant figure out how to put it inside the afk code
In response to Mxjerrett
i just did it ^

anyway its

if(usr.jail)usr<<"You cannot go AFK in jail sorry"
In response to A.T.H.K
thank you
What in the world is up with that AFK verb?
You could make this shorter with a couple ternary statements and using =!, but I've never managed to make a ternary statement compile.
    away(t as text)
if(away)
world<<"[name] has returned from away \[[awaymsg]\]."
away=0
overlays-='afk.dmi'
return
t=copytext(Process(t),1,250) // Process is just a text filter procedure I use.
if(!t)return
awaymsg=t
away=1
world<<"[name] has went away \[[awaymsg]\]"
overlays+='afk.dmi'