Escolar Documentos
Profissional Documentos
Cultura Documentos
function eventNewPlayer(p)
if not inicio and not fim then
ui.addTextArea(0, "<p align='center'><a href='event:entrada'>Clique
para participar do sorteio!", p, 200, 370, 400, 20, 1, 0xffff00, 0.8, false)
ui.addTextArea(-3, "<p align='center'><font size='30px'>"..nome, p, 5,
40, 795, 40, 1, 1, 0.8, false)
end
end
function participando(p)
for i, v in pairs(participante) do
if v == p then
return true
end
end
return false
end
function sorteio(tipo)
local lista = {}
local sorteado = 0
for i=1, #participante do
lista[i] = i
end
local rand = 0
for i, v in pairs(participante) do
ui.addTextArea(i, "<p align='center'>" .. v, nil, ((i-1)%8)*100+5,
math.floor((i-1)/8)*30+100, 90, 20, 1, 1, 0.8, false)
end
for i=1, qtd do
sorteado = math.random(#lista)
rand = lista[sorteado]
table.remove(lista, sorteado)
if tipo == "quase" then
ui.addTextArea(rand, "<p align='center'><font
color='#ffff00'>" .. participante[rand], nil, ((rand-1)%8)*100+5, math.floor((rand-
1)/8)*30+100, 90, 20, 1, 0xffff00, 0.8, false)
elseif tipo == "final" then
ui.addTextArea(rand, "<p align='center'><font
color='#00ff00'><b>" .. participante[rand], nil, ((rand-1)%8)*100+5,
math.floor((rand-1)/8)*30+100, 90, 20, 1, 0x00ff00, 0.8, false)
end
end
end
function eventLoop()
if inicio then
if fast > 0 then
sorteio("quase")
fast = fast - 1
else
sorteio("final")
inicio = false
fim = true
ui.addTextArea(-1, "<p align='center'><a
href='event:novo'>Reiniciar", adm, 650, 370, 100, 20, 1, 0x0000ff, 0.8,false)
end
end
if fim then
tfm.exec.addPhysicObject(0, 400, 200,
{type=12,color=math.random(0x666666, 0x777777), miceCollision=false, width=800,
height=400})
for i=1, 50 do
tfm.exec.displayParticle(math.random(21,24), math.random(1,800),
20, math.random(-20,20)/100, math.random(10,1000)/100, 0, 0, nil)
end
end
end
tfm.exec.disableAutoShaman(true)
tfm.exec.disableAutoNewGame(true)
tfm.exec.newGame(mapa)
ui.addTextArea(0, "<p align='center'><a href='event:entrada'>Participa por las
Donuts!", nil, 200, 370, 400, 20, 1, 0xffff00, 0.8, false)
ui.addTextArea(-1, "<p align='center'><a href='event:inicio'>Iniciar", adm, 650,
370, 100, 20, 1, 0x0000ff, 0.8,false)
ui.addTextArea(-3, "<p align='center'><font size='30px'>"..nome, nil, 5, 40, 795,
40, 1, 1, 0.8, false)
tfm.exec.setUIMapName("SORTEO BY ELI")