Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Creator: Bolodefchoco
- --Made in: 04/12/2015
- --Last update: 21/05/2016
- --[[ Notes:
- Does:
- Um jogo de quizes
- Commands:
- /
- skip --> Quanto metade da sala digitar /skip a pergunta será pulada
- ]]--
- asks = {
- easy = {
- news = {
- {"Em que estado ocorreu o ataque terrorista das torres gêmeas?",{"new york","nova york","nova iorque"}},
- {"Qual o nome dos terroristas que atacaram a França em 2015?",{"isis","estado islamico","islamicos"}},
- {"Como se chama a moeda oficial usada nos Estados Unidos da América?",{"dollar","dolar"}},
- };
- sci = {
- {"Onde o embrião se desenvolve no corpo da mãe?",{"utero","barriga"}},
- {"Como se chama o médico que cuida do olhos?",{"oftalmologista"}},
- {"Quantos planetas têm no Sistema Solar?",{'8','9','10'}},
- };
- hist = {
- {"Qual o nome do povo que vivia no Brasil antes dos portugueses?",{"indigenas","indios"}},
- {"Em qual lugar da fazenda ficavam alojados os escravos?",{"senzala"}},
- };
- entert = {
- {"Qual o nome da revista sensual mais vendida do mundo?",{"playboy"}},
- {"Em Harry Potter e a Pedra Filosofal que casa ganhou a taça das casas?",{"grifinoria"}},
- };
- pt = {
- {"Adjetivos são usados para dar____",{"qualidade","qualidades","caracteristica","caracteristicas"}},
- {"Qual dessas duas formas é a correta: min ou mim?",{"mim"}},
- {"Qual o coletivo de porcos?",{"vara"}},
- {"Qual o coletivo de lobos?",{"alcateia"}},
- };
- quiz = {
- {"Ema ema ema, qual o nome da clara do ovo?",{"clara"}},
- {"Bob Esponja _______ ________",{"calça quadrada"},{"square pants"}},
- };
- geo = {
- {"A Itália fica em qual continente?",{"europeu","europa"}},
- {"Qual a moeda do Japão?",{"iene"}},
- {"Quantos oceanos existem na Terra?",{'3'}},
- };
- };
- medium = {
- news = {
- {"Qual dos anões de Branca de Neve é mudo?",{"dunga"}},
- {"Quantos são os pecados capitais?",{'7'}},
- };
- sci = {
- {"Como se chama a primeira ovelha clonada?",{"dolly"}},
- {"Qual é a fórmula mais famosa de Einstein?",{"e=mc²","e=mc2","e=m*c^2","mc²","mc2"}},
- {"Como se chama a unidade de medida do som?",{"decibel","decibeis"}},
- {"Em que parte do nosso corpo existe um osso chamado Martelo?",{"ouvido","orelha"}},
- };
- hist = {
- {"Em que ano foi dado o golpe que instituiu o regime militar no Brasil?",{'1964'}},
- {"Em que ano foi descoberto a América?",{'1492'}},
- {"Em que ano foi descoberto o Brasil?",{'1500'}},
- };
- entert = {
- {"Qual o nome do cantor com mais views no youtube?",{"psy"}},
- {"Quem criou o Menino Maluquinho?",{"ziraldo"}},
- {"Sam e Dean são personagens de qual seriado?",{"sobrenatural","supernatural"}},
- };
- pt = {
- {"Qual região a palavra JERIMUM significa ABÓBORA?",{"nordeste"}},
- {"Qual o plural da palavra troféu?",{"trofeus"}},
- };
- quiz = {
- {"Minha mãe tinha quatro filhas: Joana, Maria, Joaquina, Marta e, por fim, Eu. O que sou Eu?",{"adotada"}},
- {"O que é que tem QUATRO letras e tirando duas fica ONZE?",{"taxi","xixi"}},
- {"Quem faz saltos sensacionais sem tirar os pés do chão?",{"sapateiro","engraxate"}},
- };
- geo = {
- {"Qual o nome dos dois países que ficam na Península Ibérica?",{"portugal","espanha","portugal e espanha","espanha e portugal"}},
- {"Qual a maior ilha do mundo?",{"groenlandia"}},
- };
- };
- hard = {
- news = {
- {"Qual foi a primeira emissora de TV no Brasil?",{"tupi","tv tupi"}},
- {"Quem liderava os três mosqueteiros?",{"d artagnan","d. artagnan","artagnan"}},
- {"O cantor Mick Jagger pertence a qual banda de rock?",{"rolling stones","the rolling stones"}},
- };
- sci = {
- {"Qual é a sigla da estação espacial internacional?",{"iss"}},
- {"Como se chama o médico especializado em tratamento de doenças da pele?",{"dermatologista"}},
- {"Qual o mamífero que voa?",{"morcego"}},
- };
- hist = {
- {"Qual o nome do primeiro presidente do Brasil?",{"marechal deodoro da fonseca","marechal deodoro","marechal fonseca"}},
- {"Como se chamou o primeiro avião feito por Santos Dumont?",{"14 bis"}},
- {"\"Saio da vida para entrar na história\". Quem escreveu essa frase em sua corta-testamento?",{"getulio vargas","vargas"}},
- };
- entert = {
- {"Smaug pertence a que filme/saga?",{"hobbit","o hobbit","the hobbit"}},
- {"Quem matou Fish na série Gotham?",{"pinguim","o pinguim"}},
- };
- pt = {
- {"Qual é o nome dado aos verbos que não podem ser conjugados na primeira pessoa?",{"defectivos","verbos defectivos"}},
- {"Qual o plural de \"calça cor-de-rosa\"?",{"calças cor-de-rosa"}},
- };
- quiz = {
- {string.reverse("1 + 1 - 1 + 2 - 1 + 2 + 3?"),{'7'}},
- {"Como fica uma vaca que faz muito exercício físico?",{"malhada","fica malhada"}},
- };
- geo = {
- {"Qual a composição do granito?",{"mica","quartzo","feldspato"}},
- };
- };
- }
- math.percent=function(number1,number2,t)
- number1,number2=tonumber(number1),tonumber(number2)
- return ((t==0 or not t) and number1/number2*100 or t==1 and (number1/100)*number2)
- end
- string.replace=function(str,listi,listo)
- for k,v in next,listi do
- for i=1,#listo do
- str=str:gsub(k,listo[v])
- end
- end
- return str
- end
- deactivateAccents=function(str,f)
- local letters = {a = {"á","à","ä","â","ã"},e = {"é","è","ë","ê"},i = {"í","ì","î","ï"},o = {"ó","ò","ö","ô","õ"},u = {"ú","ù","ü","û"}}
- for k,v in next,letters do
- for i = 1,#v do
- str = str:gsub(v[i],tostring(k))
- end
- end
- return f and str:gsub('.',f) or str
- end
- string.split=function(str,id,split)
- local list={}
- for val in string.gmatch(str,(id==0 and '[^'..(split or '%s')..']+' or id==1 and split)) do
- table.insert(list,val)
- end
- return list
- end
- string.equal=function(str1,str2)
- local equal2=function(str1,str2)
- local len = #str1
- local dif = 0
- local i = 0
- while i < len do
- i = i + .5
- if str1:sub(i,i) ~= str2:sub(i,i) then
- dif = dif + 1
- end
- end
- return 1 - dif/len
- end
- if #str1 ~= #str2 then
- local dif = #str1-#str2
- local len = math.max(#str1,#str2)
- local big,small,auxi
- if len == #str1 then
- big = str1
- small = str2
- else
- big = str2
- small = str1
- end
- local fSim,mSimi = 1.4E-45,1.4E-45
- local i = 0
- while i <= #small do
- i = i + 1
- auxi = small:sub(0,i) .. big:sub(0,i+dif) .. small:sub(i)
- fSim = equal2(big,auxi)
- if fSim > mSimi then
- mSimi = fSim
- end
- end
- return math.abs(mSimi - dif/len)
- else
- return math.abs(equal2(str1,str2))
- end
- end
- local ask,answer
- message = ""
- generateRandomQuestion=function(dif,cat)
- dif,cat = dif or 0, cat or 0
- local lvl = {"easy","medium","hard"}
- local tp = {"news","sci","hist","entert","pt","quiz","geo"}
- if dif > 0 then
- dif = lvl[dif]
- else
- dif = lvl[math.random(#lvl)]
- end
- if cat > 0 then
- cat = tp[cat]
- else
- cat = tp[math.random(#tp)]
- end
- local choice = asks[dif][cat][math.random(#asks[dif][cat])]
- ask = choice[1]
- answer = choice[2]
- end
- ui.chat = function(name,message,title,x,y,w,h)
- _G.message = message or ""
- x,y,w,h = x or 300-150/2,y or 80,w or 350,h or 200
- title = title or "Chat"
- name = name or nil
- ui.addPopup(0,2,"",name,x-1,y+200,w+1,true)
- ui.addTextArea(0,"",n,x,y,w,h,0x324650,0x212E35,1,true)
- ui.addTextArea(1,message,n,x+4,y+5,w-9,h-10,1,1,0,true)
- ui.addTextArea(2,"<font face='Lucida Console'><p align='center'><V>"..title,n,x-1,y-15,w+1,h-185,0x212E35,0x212E35,1,true)
- end
- mice={}
- eventNewPlayer=function(n)
- if not mice[n] then mice[n]={skip=false} end
- ui.chat(n,message,"Quiz")
- end
- table.foreach(tfm.get.room.playerList,eventNewPlayer)
- newQuestion,canAnswer,skip = true,false,0
- eventPopupAnswer=function(i,n,a)
- if i == 0 then
- a = a:gsub("http",''):gsub("<","<"):gsub("://",":\\\\")
- if a ~= "" and a:sub(1,1)~="/" then
- if canAnswer then
- local done,almost = false,nil
- for k,v in next,answer do
- if done then break end
- if deactivateAccents(a,string.lower) == deactivateAccents(v,string.lower) then
- done = true
- end
- if #a>4 and string.equal(deactivateAccents(a,string.lower),deactivateAccents(v,string.lower)) then
- almost = true
- end
- end
- if done then
- ui.chat(n,"<V>["..n.."] <VP>"..a.."\n"..message,"Quiz")
- ui.chat(n,"<ROSE>[Chat] <PT>"..n.." +1\n"..message,"Quiz")
- tfm.exec.setPlayerScore(n,1,true)
- newQuestion = true
- canAnswer = false
- else
- ui.chat(n,"<V>["..n.."] <R>"..a.."\n"..message,"Quiz")
- if almost then
- ui.chat(n,"<ROSE>[Chat] <PT>Você está quase lá, <J>"..n.."\n"..message,"Quiz")
- end
- end
- end
- else
- if a == "/skip" and not mice[n].skip then
- mice[n].skip = true
- skip = skip + 1
- local players = 0
- for k in next,tfm.get.room.playerList do players = players + 1 end
- if skip >= math.percent(50,players,1) then
- ui.chat(n,"<ROSE>[Chat] ** Skip ** <PT> - As respostas possíveis eram: \""..table.concat(answer,', ').."\"\n"..message,"Quiz")
- newQuestion = true
- canAnswer = false
- end
- else
- ui.chat(n,message,"Quiz")
- end
- end
- if #message > 1990 then
- ui.chat(n,"<ROSE>[Chat] <V>#2000 <J>Clear","Quiz")
- newQuestion = true
- canAnswer = false
- end
- end
- end
- eventLoop=function()
- if newQuestion then
- generateRandomQuestion(0,0)
- ui.chat(nil,"<ROSE>[Chat] <PT><B>"..ask.."</B>\n"..message,"Quiz")
- newQuestion = false
- canAnswer = true
- skip = 0
- for n in next,tfm.get.room.playerList do mice[n].skip = false end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement