Advertisement
Thetroz

[Reto] Clickear los cuadros

Oct 2nd, 2016
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.88 KB | None | 0 0
  1. local mice = {}
  2. local ganadores = {}
  3. local tabla_temporal = {}
  4. local contador = 0
  5. local contador_in = 5
  6. local tiempo = 0
  7. local text = false
  8. local time = 60
  9.  
  10. function main()
  11.     for name in pairs(tfm.get.room.playerList) do
  12.         eventNewPlayer(name)
  13.     end
  14. end
  15.  
  16. function eventLoop()
  17.     contador_in = contador_in - 0.5
  18.     if contador_in > -1 then
  19.         ui.addTextArea(0, "<p align='center'><b><font size='18'>Preparados...Empezamos en <v>"..math.ceil(contador_in).."", nil, 270, 27, 300, 50, 0x003366, 0x000000, 1)
  20.     end
  21.     if contador_in == -1 then
  22.         ui.addTextArea(0, "<p align='center'><b><font size='18'>ยกA clickear!", nil, 270, 27, 300, 50, 0x003366, 0x000000, 1)
  23.         empezar_clicks()
  24.     end
  25.     if text == true then
  26.         tiempo = tiempo + 0.5
  27.         if tiempo == 1 then
  28.             tiempo = 0
  29.             ui.addTextArea(5, "<a href='event:click'>           ", nil, math.random(50,700), math.random(50,350), 20, 20, math.random(0x000000, 0xFFFFFF), math.random(0x000000, 0xFFFFFF), 1)
  30.         end
  31.         time = time - 0.5
  32.         tfm.exec.setUIMapName(math.ceil(time))
  33.     end
  34.     if time == 0 then
  35.         time = 98888888885456
  36.         for name in pairs(tfm.get.room.playerList) do
  37.             table.insert(tabla_temporal, ""..name.." : "..mice[name].click.."")
  38.         end
  39.         table.sort(tabla_temporal, function(a,b) return a>b end)
  40.         ui.addTextArea(1, "<b><font size='14' color='#000'><p align='center'>Cantidad de clicks.</p><br>"..table.concat(tabla_temporal, "<br>").."", nil, 13, 27, 150, 200, 0x0099ff, 0x000000, 1)
  41.         text = false
  42.         ui.removeTextArea(5,nil)
  43.     end
  44. end
  45.  
  46. function eventTextAreaCallback(id, name, c)
  47.     if c == "click" then
  48.         mice[name].click = mice[name].click + 1
  49.     end
  50. end
  51.  
  52. function eventNewPlayer(name)
  53.     mice[name] = {click = 0}
  54. end
  55.  
  56.  
  57. function empezar_clicks()
  58.     text=true
  59. end
  60.  
  61. --A la hora de ganar
  62. --[[
  63.                 contador = contador + 1
  64.                 table.insert(ganadores, "<n><font color='#000'>"..contador..". "..name.."") ]]
  65.                
  66.                
  67.                 main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement