ID:140434
 
Code: Auto Afk Checks
proc/AFKCheck()
world << "<font color = blue>Afk Tests has been given out you have 10 seconds to answer it."
world << "<font color = blue>If you do not answer it you will be automatically booted."
world << "<font color = blue>If you answer it wrong you will be booted."
spawn(100)
for(var/mob/PC/N2 in world)
if(N2.client)
Start
if(N2.afktest)
world << "<font color = blue>[N2] has been booted for not responding to the afk test."
del(N2)
goto Start
else
sleep(72000)
AFKCheck()
for(var/mob/N in world)
if(N.client)
if(!N.GMLevel)
if(!N.afktest)
N.afktest = 1
var/testafk = rand(1,11)
if(testafk == 1)
var/testafk1 = input(N,"Are you AFK?","Afk Test") in list ("Yes","No")
switch(testafk1)
if("Yes")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if("No")
N << "You have answered the test correctly."
N.afktest = 0
if(testafk == 2)
var/testafk2 = input(N,"Does 2+2 = 4.1?","Afk Test") in list ("Yes","No")
switch(testafk2)
if("Yes")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if("No")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if(testafk == 3)
var/testafk3 = input(N,"Does 3+3 = 6?","Afk Test") in list ("Yes","No")
switch(testafk3)
if("Yes")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if("No")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if(testafk == 4)
var/testafk4 = input(N,"How much wood could a woodchuck chuck if a woodchuck could chuck wood?","Afk Test") in list ("9000","35","3","1.5")
switch(testafk4)
if("1.5")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if("3")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if("35")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if("9000")
N << "You have answered the test correctly."
N.afktest = 0
if(testafk == 5)
var/testafk5 = input(N,"Can you cry under water?","Afk Test") in list ("Yes","No")
switch(testafk5)
if("Yes")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if("No")
N << "You have answered the test correctly."
N.afktest = 0
if(testafk == 6)
var/testafk6 = input(N,"How fast do hotcakes sell?","Afk Test") in list ("Fast","Slow")
switch(testafk6)
if("Slow")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if("Fast")
N << "You have answered the test correctly."
N.afktest = 0
if(testafk == 7)
var/testafk7 = input(N,"Are eyebrows considered facial hair?","Afk Test") in list ("Yes","No")
switch(testafk7)
if("No")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if("Yes")
N << "You have answered the test correctly."
N.afktest = 0
if(testafk == 8)
var/testafk8 = input(N,"When Atheists go to court, do they have to swear on the bible?","Afk Test") in list ("Yes","No")
switch(testafk8)
if("Yes")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if("No")
N << "You have answered the test correctly."
N.afktest = 0
if(testafk == 9)
var/testafk9 = input(N,"If the FBI breaks your door down do they have to pay for it if it was the wrong door?","Afk Test") in list ("Yes","No")
switch(testafk9)
if("No")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if("Yes")
N << "You have answered the test correctly."
N.afktest = 0
if(testafk == 10)
var/testafk10 = input(N,"How many licks does it take to get to the center of a tootise pop?","Afk Test") in list ("100","500","To many to count","1000")
switch(testafk10)
if("100")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if("500")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if("1000")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if("To many to count")
N << "You have answered the test correctly."
N.afktest = 0
if(testafk == 11)
var/testafk11 = input(N,"If Peter Piper picked a peck of pickled peppers, how many pickled peppers did Peter Piper pick?","Afk Test") in list ("1.7725","17","20000")
switch(testafk11)
if("17")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if("20000")
world << "<font color = blue>[N] has been booted for answering the test wrong."
del(N)
if("1.7725")
N << "You have answered the test correctly."
N.afktest = 0


Problem description: Well it works it just doesn't give all the players on a test. It goes to one person and sits there until they answer it, get booted, or logout. Could anyone help with this? I wanted it to give everyone on a test that wasn't a admin. :S

Why is this needed? Just make the gameplay fun to where people won't want to lazy through it (and don't use goto).
Use an associative list that holds each question with the associated answer. Then use a for loop to loop through all the clients and spawn your input box with a picked question from the list.

EDIT
Those questions really should be just basic math problems like 2+2 and whatnot. Something anyone could answer. It is, after all, just an AFK check isn't it?
In response to Spunky_Girl (#2)
I don't know how to use a associative list but i'll go find out thx. And for the questions it was just a bunch of random stuff it will be changed when its fully finished. And to the other poster it's only fun during the day when there are events going on but for the rest of the day we have afkers on training. thx for the help o.o
In response to Inferno741 (#3)
An AFK checker is good I suppose if an event is going on (and you don't feel like moderating), but afk training should not be possible.