ID:1102244
 
(See the best response by LordAndrew.)
Code:
mob/var/AFK
var/obj/AfkIcon/AfkIcon=new
obj/AfkIcon
pixel_x=8
pixel_y=8
icon='Other.dmi'
icon_state="AFK"
layer=FLOAT_LAYER

mob/proc/CheckAFK()
if(src.client.inactivity>=20) if(!src.AFK)
src.AFK=1
src.overlays-=AfkIcon
src.overlays+=AfkIcon
else if(src.AFK)
src.AFK=0
src.overlays-=AfkIcon


Problem description: MY FRIEND DECIDED TO MAKE A AFK SYSTEM AND I HELPED HE BUT IT DONT WORK. CAN SOMEBODY TELL ME WHATS WRONG HERE? WHY THE CHARACTER AFTER 20 SEC DONT APPARE THE AFK ICON ON HIS ICON?

You don't need to type in all capitals.

As for the procedure: you need to create a loop in order for it to constantly check the client's inactivity. As it stands, it'll only do CheckAFK() once.
ok, sry for capitals i had Mayus actived and i see it when i finished the prob description.
i will try let's see if i can do it
ok after some searching i havn't found anithing, if you can explain me more about how to do this or if there are any library or tutorial and you can post it here. I just started from 4 days on this and i an not good
In response to Iamtheking123
Best response
You'd want to use a loop construct, in this case while(). Just make sure to add a sleep() within the while() to prevent it from crashing your server.
can someone tell me how i can do that?
In response to Xalexx16
Xalexx16 wrote:
can someone tell me how i can do that?


while(1)
sleep(tickamounthere)
like this?
mob
while(nomove)
sleep(10)
src.CheckAFK()