-- STOP -- Escrito por Ninguem - 31/08/2015 ADM = {"Rodybrazil"} CAT = {"Nome","Vegetal","Animal","Marca","Profissão","Objeto","TV/Filme","Lugar","Parte do corpo","O Tig é...","Transformice"} ID = {cat=1,camada=2,add=3,msg=4,tempo=5,stop=6} PLAYER = {} ESCOLHA = {} MODO = "inicio" ROUND = 1 PALAVRA = 1 MAXROUND = 5 TEMPO = false LETRA = "" function atualizaCat(first) local txt = "
Selecione as categorias.
\n\n" for i, v in pairs(CAT) do txt = txt .. string.format("Round %d/%d\n
", ROUND, MAXROUND) or "Placar final\n\n
" local cont = 0 local total = 0 local player = {} for i, v in pairs(PLAYER) do table.insert(player, {nome = i, pontos = v.pontos, vitoria = v.vitoria, num = v.num}) end table.sort(player, function(a, b) if a.pontos and b.pontos then return a.pontos > b.pontos end end) for i, v in ipairs(player) do txt = txt .. string.format("<%s>- %s - %d pontos %s\n", v.num and v.num > 0 and "vp" or "r", v.nome, v.pontos or 0, v.vitoria and v.vitoria > 0 and string.format("%s\n Você foi muito rápido! Tempo para pedir stop: <%s>%s", i, PLAYER[p].escolha[i] and "vp" or "r", v.p), p, ((i-1)%5)*160+5, math.floor((i-1)/5)*50+150, 150, 40, 1, 1, 0.8, true)
end
end
function selecionaPalavra()
for i=1, #ESCOLHA do
table.remove(ESCOLHA)
ui.removeTextArea(i+1000, nil)
end
for i, v in pairs(PLAYER) do
if v.palavra[CAT[PALAVRA]] ~= "" then
if buscaPalavra(v.palavra[CAT[PALAVRA]]) then
ESCOLHA[buscaPalavra(v.palavra[CAT[PALAVRA]])].pontos = 5
else
table.insert(ESCOLHA, {p = v.palavra[CAT[PALAVRA]], pontos = 10})
end
end
end
table.sort(ESCOLHA, function(a, b) return a.p < b.p end)
for i, v in pairs(PLAYER) do
v.escolha = {}
for j, x in pairs(ESCOLHA) do
table.insert(v.escolha, true)
end
end
ui.addTextArea(ID.cat, " " .. CAT[PALAVRA] .. " com " .. LETRA, nil, 5, 80, 790, 40, 1, 1, 0.8, true)
TEMPO = os.time() + 5000+(2000*#ESCOLHA)
ui.addTextArea(ID.tempo, " 20 Clique nas palavras ERRADAS e marque de 40 Escolha um número %d", i, i), nil, 150+((i-1)*50), 350, 40, 40, 1, 1, 0.8, true)
end
elseif arg[1] == "num" then
PLAYER[p].num = tonumber(arg[2],10)
atualizaPlayer(true)
for i=1, 10 do
ui.removeTextArea(i+30, p)
end
ui.removeTextArea(ID.msg, p)
elseif arg[1] == "palavra" then
ui.addPopup(tonumber(arg[2],10), 2, CAT[tonumber(arg[2],10)], p, 300, 200, 200, true)
elseif arg[1] == "escolha" then
PLAYER[p].escolha[tonumber(arg[2],10)] = PLAYER[p].escolha and not PLAYER[p].escolha[tonumber(arg[2],10)] or false
if PLAYER[p].escolha then
ui.addTextArea(tonumber(arg[2],10)+1000, string.format(" <%s>%s", tonumber(arg[2],10), PLAYER[p].escolha and PLAYER[p].escolha[tonumber(arg[2],10)] and "vp" or "r", ESCOLHA[tonumber(arg[2],10)] and ESCOLHA[tonumber(arg[2],10)].p or ""), p, ((tonumber(arg[2],10)-1)%5)*160+5, math.floor((tonumber(arg[2],10)-1)/5)*50+150, 150, 40, 1, 1, 0.8, true)
end
if not PLAYER[p].escolha[tonumber(arg[2],10)] then
--tfm.exec.chatMessage(" %d Round %d/%d\n A letra é:\n %d 40 Escolha um número