21 Dec 13, 01:22AM
(This post was last modified: 25 Dec 13, 07:03PM by Speedbomb00.)
(20 Jun 10, 05:34PM)Andrez Wrote: 7. AFK Script
It automatically changes your nickname from "nickname" to "afk|nickname" after some inactivity period.[SELECT ALL] Code://AFK Script
//by CiD
//TODO: make a settings menu
//User Settings
//This is what will be added to your name when you are AFK.
afkstr = "|afk"
//If set to 1, it will display a message to other players when you go AFK. Set to 0 to disable.
afkshowmessage = 1
//This will be placed after your name and sent to other players.
afkmessage = "is no longer available."
//This is how long (in seconds) the script will wait if you are idle before changeing you to AFK.
timeuntilafk = 20
//DO NOT EDIT BELOW HERE
curafk = 0
afktime = 0
alias afk [
if $arg1 [
if (= $curafk 0) [
oldname = $curname
name (concatword $oldname $afkstr)
curafk = 1
echo "You are now set to: AFK"
if $afkshowmessage [say (concat "AFKScript:" $oldname $afkmessage )]
]
] [
if $curafk [
name $oldname
curafk = 0
echo "You are now set to: ONLINE"
]
]
]
alias notafk [
if (= $afktime 0) [afkcheck]
afktime = 0
if (= $curafk 1) [afk 0]
]
alias afkcheck [
afktime = (+ $afktime 5)
if (= 2 (+ (> $afktime (* $timeuntilafk 1000)) (= $curafk 0))) [afk 1]
sleep 5 afkcheck
]
bind w [forward;notafk]
bind a [left;notafk]
bind s [backward;notafk]
bind d [right;notafk]
//END of AFK Script
This didn't work completely for me, so I wrote a modified version. Credits are in the script. I feel like I'm kinda wasting my time posting this, but if anyone wants it, have fun. If you just want to download the .cfg file and add it straight to your "scripts" folder, click -->here<--.
[SELECT ALL] Code:
//Credits to CiD's AFK Script http://forum.cubers.net/thread-38.html (posted by Andrez)
//Note: I don't mean to steal script or claim I built this from scratch. This is credited to CiD's AFK script, whom I based my script off of, since his wasn't working for me, and it had excess coding.
//Usage: When you need to go afk, type "/afk". This will switch you to team spectator and add "-AFK" to your name, as well as printing to the console the afkmessage. When you want to stop being afk, type "/afk" again, this will remove the "-AFK", switch you to a team, and print a message announcing your return.
//Copyright or License: I don't really care if you modify this, just please credit both CiD's AFK Script and myself, Speedbomb00.
afksuf = "-AFK"
afkmessage = "is now afk."
returnmessage = "is no longer afk."
curafkmode = 0
alias afk [
if $arg1 [
if (= $curafkmode 0) [
oldname = $curname
me $afkmessage
name (concatword $oldname $afksuf)
curafkmode = 1
spectate] [
if $arg1 [
if (= $curafkmode 1) [
name $oldname
curafkmode = 0
me $returnmessage
spectate
]
]
]
]
]