Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Creator: Bolodefchoco
- --Made in: 19/07/2016
- --Last update: 19/07/2016
- --[[ Notes:
- Does:
- Cria uma sondagem.
- Commands
- !
- start --> Inicia uma nova sondagem
- show --> Apresenta o resultado da sondagem
- ]]--
- adm = {["Bolodefchoco#0000"]=1}
- ask = "Impeachment da Galaktine?"
- answers = [[
- Sim
- Çim
- Não
- Claro
- Não conheço
- ]]
- startVotation=function(n)
- local str = "<p align='center'><font size='30'><VP><u>Sondagem</u></VP></font>\n\n<font size='16'><CE>"..(#ask>40 and ask:sub(1,40).."<a href='event:!!'><J>...</J></a>" or ask).."</CE>\n<font size='13'>\n"
- for id,v in next,answer do
- str = str .. "<a href='event:@"..id.."'>"..(#v>25 and v:sub(1,25).."</a><J><a href='event:!"..id.."'>...</a></J>" or v.."</a>").."\n"
- end
- ui.addTextArea(0,str,n,220,80,360,270,0x324650,0x181818,1,true)
- end
- game = false
- eventNewPlayer=function(n)
- if game then
- startVotation(n)
- end
- end
- eventTextAreaCallback=function(i,n,c)
- if c:sub(1,1) == "!" then
- if c:sub(2,2) == "!" then
- ui.updateTextArea(0,"<p align='left'><font size='20'><PT><a href='event:back'>Voltar</a> <ROSE>| <PT>Pergunta :<V><font size='16'>\n\n\t"..ask,n)
- else
- c = tonumber(c:sub(2))
- ui.updateTextArea(0,"<p align='left'><font size='20'><PT><a href='event:back'>Voltar</a> <ROSE>| <PT>Opção "..c.." :<V><font size='16'>\n\n\t"..answer[c],n)
- end
- elseif c == "back" then startVotation(n)
- elseif c:sub(1,1) == "@" then
- c = tonumber(c:sub(2))
- score[c] = score[c] + 1
- ui.removeTextArea(0,n)
- votes = votes+1
- ui.addTextArea(1,"<PT><B>Votos: "..votes,nil,5,380,nil,nil,1,1,0,true)
- end
- end
- math.percent=function(number1,number2,_type)
- number1,number2=tonumber(number1),tonumber(number2)
- return ((_type==0 or not _type) and number1/number2*100 or _type==1 and (number1/100)*number2)
- end
- eventChatCommand=function(n,c)
- if adm[n] then
- if c == "start" then
- game = true
- answer,score,votes={},{},0
- for v in answers:gmatch('[^\n]+') do if v~="" then
- table.insert(answer,v);table.insert(score,0) end
- end
- startVotation(nil)
- elseif c == "show" then
- game = false
- local result = 0
- for i,v in next,score do
- result = result + tonumber(v)
- end
- local str = "<p align='center'><font size='30'><VP><u>Resultados</u></VP></font>\n\n<font size='16'><CE>"..(#ask>40 and ask:sub(1,40).."<J>...</J>" or ask).."</CE>\n<font size='13'>\n"
- for id,v in next,answer do
- str = str .. "<V>"..(#v>20 and v:sub(1,20).."<J>...</J>" or v).." <G>"..math.percent(score[id],result).."% - ("..score[id]..")\n"
- end
- ui.addTextArea(0,str,nil,220,80,360,270,0x324650,0x181818,1,true)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement