Leonardo Leandro Posted June 10, 2017 Share Posted June 10, 2017 Sorry for the mistakes but I'm Brazilian and I do not know how to speak English How to make a scripting answer questions altomatically in chat EX: Who discovered brazil? Play: Perdo alvares cabaral Play won 200 per hit the question! Link to comment
Hale Posted June 10, 2017 Share Posted June 10, 2017 Depending if it's a server or client side, use onChatMessage/onClientChatMessage. Use of those 2 events is explained in examples written in the wiki. Link to comment
idarrr Posted June 11, 2017 Share Posted June 11, 2017 (edited) This is a simple Quiz code. /createquiz - To create a Quiz. /answer - To answer the Quiz. /deletequiz - To delete unanswered Quiz. Server Side code: theAnswer = nil function createQuiz(thePlayer, cmd, quiz, answer) if theAnswer then outputChatBox("You can't create a Quiz. Use /deletequiz first to delete previous Quiz.", thePlayer) return end if not quiz or not answer then outputChatBox("SYNTAX: /"..cmd.." [Question] [Answer]", thePlayer) return end theAnswer = answer outputChatBox("QUIZ: "..quiz.."?", root) outputChatBox("QUIZ: Use command /answer to answer the quiz.", root) end addCommandHandler("createquiz", createQuiz) function deleteQuiz () if theAnswer then theAnswer = nil outputChatBox("QUIZ: Quiz has been deleted.", root) end end addCommandHandler("deletequiz", deleteQuiz) function answerQuiz (thePlayer, cmd, answer) if not theAnswer then outputChatBox("QUIZ: There is no Quiz.", thePlayer) return elseif not answer then outputChatBox("SYNTAX: /"..cmd.." [Answer]", thePlayer) return end if answer == theAnswer then theAnswer = nil outputChatBox("QUIZ: "..getPlayerName(thePlayer).." win the Quiz!", root) outputChatBox("QUIZ: The correct answer is \""..answer..".\"", root) givePlayerMoney(thePlayer, 200) end end addCommandHandler("answer", answerQuiz) Edited June 11, 2017 by idarrr Server side script Link to comment
Leonardo Leandro Posted October 14, 2017 Author Share Posted October 14, 2017 (edited) Do you have any questions that are automatic? Edited October 14, 2017 by Leonardo Leandro Link to comment
Captain Cody Posted October 14, 2017 Share Posted October 14, 2017 What I would recommend is using string.count and look for key words. Link to comment
Leonardo Leandro Posted October 14, 2017 Author Share Posted October 14, 2017 Cody How can I use String.count ? Link to comment
Scripting Moderators thisdp Posted October 14, 2017 Scripting Moderators Share Posted October 14, 2017 (edited) 1 hour ago, Leonardo Leandro said: Cody How can I use String.count ? #str string.len(str) utf8.len(str) which one will you choose? Edited October 14, 2017 by thisdp Link to comment
Scripting Moderators thisdp Posted October 15, 2017 Scripting Moderators Share Posted October 15, 2017 (edited) Does it support utf8? Edited October 15, 2017 by thisdp Link to comment
Captain Cody Posted October 15, 2017 Share Posted October 15, 2017 Why wouldn't it, also; utf8.len only returns the length of it, not if the string is within the text. Link to comment
Scripting Moderators thisdp Posted October 15, 2017 Scripting Moderators Share Posted October 15, 2017 48 minutes ago, CodyJ(L) said: Why wouldn't it, also; utf8.len only returns the length of it, not if the string is within the text. It is because I didn't understand him. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now