Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local admin = "Thetroz" --Cambia por tu nombre
- local modo = 0
- local jugadores = {}
- local jugadores_c = 0
- for j in pairs(jugadores) do jugadores_c = jugadores_c + 1 end
- local continue = true
- function main()
- table.foreach(tfm.get.room.playerList, function(k,v) preguntar(k) end)
- end
- function sorteo(m)
- if m == 1 then
- ui.addTextArea (4, "<p align='center'><font size='20'>ESCOGIENDO UN GANADOR DE LOS JUGADORES PRESENTES...", nil, 100, 100, nil, nil, 0x000001, 0x000001, 0.8, true)
- timerb = true
- timer = 15
- elseif m == 2 then
- ui.addTextArea (4, "<p align='center'><font size='20'>ESCOGIENDO UN GANADOR DE LOS JUGADORES EN LA LISTA...", nil, 100, 100, nil, nil, 0x000001, 0x000001, 0.8, true)
- timerb = true
- timer = 15
- end
- end
- function eventLoop()
- if timerb == true then
- timer = timer - 0.5
- if timer == 0 then
- wons()
- timer = 15
- timerb = false
- end
- end
- end
- function wons()
- jugador = jugadores[math.random(#jugadores)]
- ui.addTextArea (4, "<p align='center'><font size='20'><j>"..jugador.."<n> ES EL/LA GANADOR(A)!!!!", nil, 300, 100, nil, nil, 0x000001, 0x000001, 0.8, true)
- animation()
- end
- function animation()
- for i=1,150 do tfm.exec.displayParticle (math.random(21,24), math.random(1,800), math.random(1,400)) end
- end
- function start()
- if modo == 1 then
- playershere()
- elseif modo == 2 then
- createList()
- end
- end
- function createList()
- ui.addPopup (1, 2, "Inserta uno por uno los nombres de los jugadores de la rifa. Cuando termines presiona el botón '<b>Terminar y empezar rifa</b>'<br><br>Insertar jugador #"..jugadores_c+1, admin, 200, 100, 240, true)
- ui.addTextArea (2, "<p align='center'><a href='event:end'>Terminar y empezar rifa", name, 5, 30, 200, 20, 0x000001, 0x000001, 0.8, true)
- end
- function eventPopupAnswer (id,name,answer)
- if id == 1 then
- table.insert(jugadores,answer)
- jugadores_c = jugadores_c + 1
- if continue == true then
- ui.addPopup (1, 2, "Inserta uno por uno los nombres de los jugadores de la rifa. Cuando termines presiona el botón '<b>Terminar y empezar rifa</b>'<br><br>Insertar jugador #"..jugadores_c+1, admin, 200, 100, 240, true)
- end
- end
- end
- function playershere()
- table.foreach(tfm.get.room.playerList, function(k,v) table.insert(jugadores,k) end)
- sorteo(1)
- end
- function preguntar(name)
- if name == admin then
- elegirModo(name)
- end
- end
- function elegirModo(name)
- ui.addTextArea (1, "<p align='center'><font color='000001'>Elige un modo de rifa", name, 200, 100, 240, 150, 0x000001, 0x000001, 0.5, true)
- ui.addTextArea (2, "<p align='center'><a href='event:jp'>Con los jugadores presentes", name, 220, 150, 200,20, 0x000001, 0x000001, 0.8, true)
- ui.addTextArea (3, "<p align='center'><a href='event:lj'>Con una lista de jugadores", name, 220, 190, 200, 20, 0x000001, 0x000001, 0.8, true)
- end
- function eventTextAreaCallback(id,name,event)
- if event == "jp" then
- for i=1,3 do ui.removeTextArea(i,name) end
- modo = 1
- start()
- elseif event == "lj" then
- for i=1,3 do ui.removeTextArea(i,name) end
- modo = 2
- start()
- elseif event == "end" then
- continue = false
- ui.addPopup (1, 0, "", admin, 5, 50000)
- sorteo(2)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement