Quiz script
Set these var's
/Set #Ansrn, 0
/Set #Temp, 0
/Set #QuizM, 0
/Set #Quiz, 0
/Set #QuizTimer, 0
/Set #QuizStart, 0
/Set #QuizStart, 0
/Set #QuizTimer, 0
/Set #OQ, 0
script
//Quiz script Version 1.4 by Steve.
If $Message = "/Start Q" AND #GetValue($GetPlayerInfo(#Source, PSID) & "/Extended") > 0
If #Quiz = 1
/SendPM #Source, "*** There is already a quiz running. "
Else
/Set #Phase(#Source), 3
/SendPM #Source, " "
/SendPM #Source, "*** Please type the number of questions you want to ask. You can have the minimum of 10 questions and the maximum of 100. "
/SendPM #Source, " "
/Set #QuizStarter, #Source
/SaveValue $GetPlayerInfo(#QuizStarter, PSID) & "/QS", 1
/StopEvent
/Exit
EndIf
EndIf
If #Phase(#Source) = 3
/Set #TempA, $Message
If #TempA < 10 OR #TempA > 100
/SendPM #Source, "*** You can't ask less than 10 or more than 100 questions. Please choose a different number or type /Cancel to cancel. "
Else
/Set #QQ, $Message
/SendPM #Source, "*** Sucessfully set the number of questions as " & $Str(#QQ)
/SendPM #Source, "*** Now type the number of coins you want to give away for every question answered correctly. (1 - 5 coins.) "
/Set #Phase(#Source), 9
/StopEvent
/Exit
EndIf
EndIf
If #Phase(#Source) = 9
/Set #TempA, $Message
If #TempA < 1 OR #TempA > 5
/SendPM #Source, "*** It must be between 1 and 5! "
Else
/Set #TempQP, $Message
/SendPM #Source, "*** Sucessfully set as " & $Str(#TempQP)
/Set #Quiz, 1
/Set #QuizTimer, 1
/Set #QuizStart, 2
/Set #QQZ, 0
/SendAll $Name(#Source) & " has started a quiz with " & $Str(#QQ) & " questions. Type /Join Quiz to join the quiz.: "
/SendAll $Bot & " You get " & $Str(#TempQP) & " coins for every question answered correctly. "
/SendAll "*** You have 2 minutes to join. "
/Set #Phase(#Source), 0
/Set #OQ, 0
EndIf
EndIf
If $Message = "/Join Quiz" AND #Quiz = 1
If #QuizStart = 1
/SendPM #Source, "*** The Quiz has already started! "
EndIf
If #Joined(#Source) = 1
/SendPM #Source, "*** You have already joined. "
Else
/Set #Joined(#Source), 1
/SendAll "*** " & $Name(#Source) & " has joined the quiz! "
/SendPM #Source, "*** You have sucessfully joined the quiz. "
/Inc #QuizM, + 1
/StopEvent
/Exit
EndIf
EndIf
If #QuizStart = 1
If $Left($Message, 3) = "/Q " AND #GetValue($GetPlayerInfo(#QuizStarter, PSID) & "/QS") = 1
If #OQ = 1
/SendPM #Source, "*** You already asked a question! Wait until they answer this one. "
Else
/Set #Ansrn, 1
/Set $Question, $Right($Message, #Len($Message) - 3)
/SendPM #Source, "*** Question set as: " & $Question & ". Now please type the answer to the question. "
/Set #Phase(#Source), 7
/StopEvent
/Exit
EndIf
EndIf
EndIf
If #Phase(#Source) = 7
/Set $Answer, $Message
/SendPM #Source, "*** Answer set as " & $Answer
/Inc #QQZ, + 1
/Set #Ansrn, 1
/Set #OQ, 1
/SendPM #Source, " "
/SendAll "*** Question " & $Str(#QQZ) & " of " & $Str(#QQ) & ": " & $Question
/SendPM #Source, " "
/SendAll "*** Answer quickly! "
/SendPM #Source, " "
/Set #Phase(#Source), 0
/StopEvent
/Exit
EndIf
If #Joined(#Source) = 1
If #Ansrn = 1
If $Message = $Answer
/SendAll " "
/SendAll $Name(#Source) & " answered the question correctly!: "
/SaveValue $GetPlayerInfo(#Source, PSID) & "/Coins", #GetValue($GetPlayerInfo(#Source, PSID) & "/Coins") + #TempQP
/Set #Ansrn, 0
/SendAll " "
/SendAll "*** They earned " & $Str(#TempQP)
/SendAll " "
/Set #OQ, 0
If #QQZ = #QQ
/SendAll "The Quiz is now over!: "
/SendAll " "
/Set #Ansrn, 0
/Set #Temp, 0
/Set #QuizM, 0
/Set #Quiz, 0
/Set #QuizTimer, 0
/Set #QuizStart, 0
/Set #QuizStart, 0
/Set #QuizTimer, 0
If #GetValue($GetPlayerInfo(#QuizStarter, PSID) & "/QS") = 1
/SaveValue #GetValue($GetPlayerInfo(#QuizStarter, PSID) & "/QS"), 0
GoTo USJNC
EndIf
Else
/SendAll $Str(#QuizStarter) & " will now ask a question: "
/SendPM #QuizStarter, "*** Please now ask a question by typing /Q [Question] replacing [Question] with your question. "
EndIf
EndIf
EndIf
EndIf
If $Message = "/StopQuiz" AND #GetValue($GetPlayerInfo(#Source, PSID) & "/Extended") > 0 AND #Quiz = 1
/Set #Ansrn, 0
/Set #Temp, 0
/Set #QuizM, 0
/Set #Quiz, 0
/Set #QuizTimer, 0
/Set #QuizStart, 0
/Set #QuizTimer, 0
If #GetValue($GetPlayerInfo(#QuizStarter, PSID) & "/QS") = 1
/SaveValue $GetPlayerInfo(#QuizStarter, PSID) & "/QS", 0
/Set #QuizStarter, 0
EndIf
/SendAll $Name(#Source) & " cancelled the quiz.: "
GoTo USJNC
:USJNC
/Inc #Temp
If #IsLoaded(#Temp) <> 0
/Set #Joined(#Temp), 0
EndIf
If #Temp < #MaxUsers
GoTo USJNC
EndIf
EndIf