alditojeje

SimonDice

Aug 29th, 2020 (edited)
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 39.08 KB | None | 0 0
  1. --[[
  2.                 Total minijuegos: 58
  3.             ]] --[[
  4. Cosas por hacer ;v 
  5.         Contador
  6.         Sistema dificultad
  7. ------------------------
  8.         Minijuegos:
  9.         Repetir una secuencia de caritas
  10.         Tas chikito
  11.         Transformar a alguien en vamp, alejarlo de los demas, cuando alguien más se transforme, se muera
  12.         Abraza a alguien U//w//U r
  13.         Escribe !hate [nombreDeJugador] para matar al jugador mas odiado
  14.         Cuál es el número de tu titulo? [pa hard i guess] wtf imposible SI ES POSIBLE
  15.         Escribe el nombre de tu tribu ["Ninguno"] si no tienes
  16.         ¿En que fecha te registraste?
  17.         Cuántos puntos tienes?
  18.         Saltar es mas pesado // tfm.exec.movePlayer(name, 0, 0, true, 0, 100, true)
  19.        
  20.  
  21.         cuantos ratones vivos quedan?
  22.         Cómo se llama la sala?
  23.         TP JUSTO AL FINAL DE TODO EL MAPA
  24.         portal quieto, y Portal moviendose,
  25.         cañon te empuja a algun lado
  26.         hielo en el centro, lava, dar meeps
  27.  
  28.         Llueven cajas
  29.  
  30. ]] local admin = {
  31.     ['Blood#3565'] = true,
  32.     ['His#0439'] = true,
  33.     ['Alditohacker#0000'] = true,
  34.     ['Fafee#0000'] = true
  35. }
  36. local counter = 0
  37. local seconds = 20
  38. local rounds = 0
  39. local difficulty = 0
  40. local message = ""
  41. local timeNewRound = os.time()
  42. local lastClick = {}
  43. local player = {info = {}}
  44. local killPlayers = {}
  45. local counterMinigames = 0
  46. local minigameManual = false
  47. local frases = {
  48.     "Fafee es el mejor Funcorp", "Esternocleidomastoideo",
  49.     "Electroencefalografia", "Fafee es el peor Funcorp", "Up: 368 W: 0 Z: 0"
  50. }
  51. local numMatar = 0
  52. local movIzq = false
  53. local posPortalX = {550, 600, 650, 100, 150, 200, 250, 300, 350, 400, 450, 550}
  54. local gameStarted = false
  55.  
  56. tfm.exec.disableAutoNewGame()
  57. tfm.exec.disableAutoShaman()
  58. tfm.exec.disableAutoTimeLeft()
  59. tfm.exec.disablePhysicalConsumables()
  60. tfm.exec.disableAutoScore()
  61. tfm.exec.disableAfkDeath(true)
  62.  
  63. teclasPlayer = function(nombre)
  64.     tfm.exec.bindKeyboard(nombre, 37, true, true) -- Arrow Left
  65.     tfm.exec.bindKeyboard(nombre, 38, true, true) -- Arrow UP
  66.     tfm.exec.bindKeyboard(nombre, 39, true, true) -- Arrow Right
  67.     tfm.exec.bindKeyboard(nombre, 40, true, true) -- Arrow Down
  68.     tfm.exec.bindKeyboard(nombre, 83, true, true) -- S
  69.     tfm.exec.bindKeyboard(nombre, 87, true, true) -- W
  70.     tfm.exec.bindKeyboard(nombre, 65, true, true) -- A
  71.     tfm.exec.bindKeyboard(nombre, 68, true, true) -- D
  72.     tfm.exec.bindKeyboard(nombre, 69, true, true) -- E
  73.     -- tfm.exec.bindKeyboard(nombre, 81, true, true) -- Q
  74.     -- tfm.exec.bindKeyboard(nombre, 90, true, true) -- Z
  75. end
  76.  
  77. --------------- system by bolodefchoco
  78. local players = {room = {_count = 0}, alive = {_count = 0}, dead = {_count = 0}}
  79.  
  80. local copy = function(list)
  81.     local out = {}
  82.     for k, v in next, list do out[k] = v end
  83.     return out
  84. end
  85.  
  86. local insert = function(where, playerName)
  87.     if not where[playerName] then
  88.         where._count = where._count + 1
  89.         where[where._count] = playerName
  90.         where[playerName] = where._count
  91.     end
  92. end
  93.  
  94. local remove = function(where, playerName)
  95.     if where[playerName] then
  96.         where._count = where._count - 1
  97.         where[where[playerName]] = nil
  98.         where[playerName] = nil
  99.     end
  100. end
  101.  
  102. eventNewPlayer = function(playerName)
  103.     player.info[playerName] = {}
  104.     system.bindMouse(playerName, true)
  105.     teclasPlayer(playerName)
  106.     insert(players.room, playerName)
  107.     if gameStarted then
  108.         insert(players.dead, playerName)
  109.     else
  110.         tfm.exec.respawnPlayer(playerName)
  111.     end
  112.     ui.addTextArea(0, "<R><font size='20'><p align='center'>" .. seconds ..
  113.                        "</R>", playerName, 378, 32, 30, 30, 0x2B2B2B, 0x121212,
  114.                    0.7, true)
  115.  
  116.     texto =
  117.         "\n<BV><font size='16'>Este script está en beta y <R>puede contener fallos</R>. No todo debe de funcionar correctamente."
  118.  
  119.     ui.addTextArea(666, texto, playerName, 200, 130, 400, 100, 0x2B2B2B,
  120.                    0x121212, 1, true)
  121.     ui.addTextArea(667,
  122.                    "<p align='center'><font size ='13' color='#00C17C'><b>Información",
  123.                    playerName, 350, 115, 100, 20, 0x2B2B2B, 0x121212, 1, true)
  124.     ui.addTextArea(668,
  125.                    "<p align='center'><V><a href='event:cerrar'><font size='14' color='#F93018'><b>X",
  126.                    playerName, 583, 128, 0, 0, 0, 0, 1, true)
  127. end
  128.  
  129. for playerName in next, tfm.get.room.playerList do eventNewPlayer(playerName) end
  130.  
  131. eventPlayerLeft = function(playerName) remove(players.room, playerName) end
  132.  
  133. eventPlayerDied = function(playerName)
  134.     remove(players.alive, playerName)
  135.     insert(players.dead, playerName)
  136. end
  137.  
  138. eventPlayerRespawn = function(playerName)
  139.     remove(players.dead, playerName)
  140.     insert(players.alive, playerName)
  141.     print("Agregado: " .. playerName)
  142. end
  143.  
  144. eventNewGame = function()
  145.     players.dead = {_count = 0}
  146.     players.alive = copy(players.room)
  147. end
  148.  
  149. ---------
  150.  
  151. addGender = function(nombre)
  152.     if tfm.get.room.playerList[nombre].gender == 2 then
  153.         player.info[nombre].genero = "masculino"
  154.     elseif tfm.get.room.playerList[nombre].gender == 1 then
  155.         player.info[nombre].genero = "femenino"
  156.     else
  157.         player.info[nombre].genero = "ninguno"
  158.     end
  159. end
  160.  
  161. roundWin = function(nombre)
  162.     if not player.info[nombre].roundWin then
  163.         tfm.exec.chatMessage("<BV>¡Ronda completada!</BV>", nombre)
  164.         player.info[nombre].roundWin = true
  165.     end
  166. end
  167.  
  168. stats = function()
  169.     for nombre in pairs(players.alive) do
  170.         if nombre ~= "_count" and tonumber(nombre) == nil then
  171.             player.info[nombre].roundWin = false
  172.             player.info[nombre].clicks = 0
  173.             player.info[nombre].explosions = 0
  174.             player.info[nombre].countE = 0
  175.             player.info[nombre].team = ""
  176.             player.info[nombre].clicksTextareas = 0
  177.             player.info[nombre].numero = 0
  178.             -- if player.info[nombre].inRoom then
  179.             addGender(nombre)
  180.             -- end
  181.         end
  182.     end
  183. end
  184.  
  185. eventMouse = function(nombre, posX, posY)
  186.     if not players.alive[nombre] then return end
  187.     if minigame == 3 or minigame == 58 then
  188.         player.info[nombre].clicks = player.info[nombre].clicks + 1
  189.         if player.info[nombre].clicks >= clicksToWin then
  190.             roundWin(nombre)
  191.         end
  192.     elseif (minigame == 66 or minigame == 107) and
  193.         player.info[nombre].explosions > 0 then
  194.         tfm.exec.explosion(posX, posY, fuerza, 50, true)
  195.         tfm.exec.displayParticle(10, posX, posY)
  196.         player.info[nombre].explosions = player.info[nombre].explosions - 1
  197.     elseif (minigame == 67 and #lastClick > 1) or
  198.         (minigame == 107 and #lastClick > 2) then
  199.         removeItem(lastClick, nombre)
  200.         roundWin(nombre)
  201.     end
  202. end
  203.  
  204. infoGame = function(message)
  205.     ui.addTextArea(1, "<BV><font size='20'><p align='center'><b>" .. message ..
  206.                        "</BV></b>", nil, 150, 360, 500, 30, 0x2B2B2B, 0x121212,
  207.                    0.9, true)
  208. end
  209.  
  210. eventChatMessage = function(nombre, mensaje)
  211.     if not players.alive[nombre] then return end
  212.     if minigame == 1 then
  213.         if mensaje:lower() == player.info[nombre].genero then
  214.             roundWin(nombre)
  215.         end
  216.     elseif minigame == 11 or minigame == 56 then
  217.         tfm.exec.killPlayer(nombre)
  218.     elseif (minigame == 15 or minigame == 50 or minigame == 100) and mensaje ==
  219.         tostring(numeroMinigame) then
  220.         roundWin(nombre)
  221.     elseif minigame == 18 and mensaje == "2010" then
  222.         roundWin(nombre)
  223.     elseif minigame == 21 and mensaje:lower() == frases[frase]:lower() then
  224.         roundWin(nombre)
  225.     elseif (minigame == 22 or minigame == 59 or minigame == 103) and
  226.         tonumber(mensaje) and tonumber(mensaje) > 0 and tonumber(mensaje) <=
  227.         numMatarMax then
  228.         player.info[nombre].numero = tonumber(mensaje)
  229.     end
  230. end
  231.  
  232. saberDificultad = function()
  233.     if difficulty == 0 then
  234.         return "<PT>Fácil</PT>"
  235.     elseif difficulty == 1 then
  236.         return "<A:ACTIVE>Medio</A:ACTIVE>"
  237.     elseif difficulty == 2 then
  238.         return "<R>Difícil</R>"
  239.     elseif difficulty == 3 then
  240.         return "<font color='#F93018'>Experto</font>"
  241.     end
  242. end
  243.  
  244. clickTextareas = function()
  245.     for i = 100, cantidad + 100 do
  246.         ui.addTextArea(i,
  247.                        "<BV><font size='34'><p align='center'><a href='event:clicksTextarea'>•</BV>",
  248.                        nil, math.random(20, 780), math.random(50, 300), 0, 0, 0,
  249.                        0, 0, true)
  250.     end
  251. end
  252.  
  253. tpEsquinas = function()
  254.     for nombre in pairs(players.alive) do
  255.         if nombre ~= "_count" and tonumber(nombre) == nil then
  256.             if players.alive._count % 2 == 0 then
  257.                 tfm.exec.movePlayer(nombre, 200, 330)
  258.             else
  259.                 tfm.exec.movePlayer(nombre, 600, 330)
  260.             end
  261.         end
  262.     end
  263. end
  264.  
  265. shuffleList = function()
  266.     shuffled = {}
  267.     math.randomseed(os.time())
  268.     for nombre in pairs(players.alive) do
  269.         if nombre ~= "_count" and tonumber(nombre) == nil then
  270.             local pos = math.random(1, #shuffled + 1)
  271.             table.insert(shuffled, pos, nombre)
  272.         end
  273.     end
  274.     return shuffled
  275. end
  276.  
  277. parejas = function()
  278.     local list = shuffleList() -- randomiza playersAlive
  279.     local l = #list
  280.     local i = 1
  281.     while i <= l do
  282.         tfm.exec.linkMice(list[i], list[i + 1], true)
  283.         i = i + 2
  284.     end
  285. end
  286.  
  287. chooseMinigame = function(min, max)
  288.     minigame = math.random(min, max)
  289.     if (minigame == 68) and players.alive._count % 2 > 0 then
  290.         chooseMinigame(min, max)
  291.     end
  292. end
  293.  
  294. cleanMap = function()
  295.     for i = 100, 130 do -- remove all
  296.         ui.removeTextArea(i, nil)
  297.     end
  298.     ui.removeTextArea(7, nil) -- remove ganador palta/aguacate
  299.  
  300.     for i = 66, 69 do tfm.exec.removePhysicObject(i) end
  301.  
  302.     tfm.exec.addShamanObject(26, 400, 400) -- portales
  303.     tfm.exec.addShamanObject(27, 400, 400) -- portales
  304. end
  305.  
  306. newRound = function()
  307.     counterMinigames = 0
  308.     counterMinigames2 = 0
  309.     gameStarted = true
  310.     rounds = rounds + 1
  311.     if rounds == 16 or rounds == 26 or rounds == 30 or rounds == 50 then -- En las rondas 5, 10, 20 y 30 aumenta la difcultad
  312.         difficulty = difficulty + 1
  313.     end
  314.     ui.setMapName("<N>Dificultad: </N>" .. saberDificultad() ..
  315.                       "  <G>|</G>  <N>Ronda: </N><BV>" .. rounds)
  316.     stats()
  317.     cleanMap()
  318.     if difficulty == 0 then -- EASY
  319.         if not minigameManual then chooseMinigame(1, 28) end
  320.         seconds = 10
  321.         if minigame == 1 then
  322.             message = "Escribe el género de tu perfil"
  323.         elseif minigame == 2 then
  324.             message = "¡Esquiva la lava!"
  325.             lavaW = 30
  326.             lavaH = 25
  327.             cantidadLava = 2
  328.             allWin()
  329.         elseif minigame == 3 then
  330.             clicksToWin = 10
  331.             message = "¡Haz click en la pantalla <R>" .. clicksToWin ..
  332.                           "</R> veces!"
  333.         elseif minigame == 4 then
  334.             message = "¡Quédate MIRANDO hacia la derecha!"
  335.         elseif minigame == 5 then
  336.             message = "¡Quédate MIRANDO hacia la izquierda!"
  337.         elseif minigame == 6 then
  338.             message = "¡Agachate para cavar tu tumba!"
  339.             allWin()
  340.         elseif minigame == 7 then
  341.             message = "¡No saltes!"
  342.             allWin()
  343.         elseif minigame == 8 then
  344.             message = "¡No te muevas!"
  345.             allWin()
  346.         elseif minigame == 9 then
  347.             message = "Lanza confeti 5 veces"
  348.         elseif minigame == 10 then
  349.             message = "¡Baila!"
  350.         elseif minigame == 11 then
  351.             message = "Si mandas un mensaje, ¡mueres!"
  352.             allWin()
  353.         elseif minigame == 12 then
  354.             seconds = 7
  355.             message = "¡Todos tienen meep!"
  356.             allWin()
  357.             meep(true)
  358.         elseif minigame == 13 then
  359.             message = "¡No te muevas hacia la derecha!"
  360.             allWin()
  361.         elseif minigame == 14 then
  362.             message = "¡No te muevas hacia la izquierda!"
  363.             allWin()
  364.         elseif minigame == 15 then
  365.             numeroMinigame = math.random(1000000, 10000000)
  366.             message = "Escribe este numero: <R>" .. numeroMinigame .. "</R>"
  367.         elseif minigame == 16 then
  368.             message = "¿Palta o Aguacate? ¡Morirá el peor equipo!"
  369.             ui.addTextArea(5,
  370.                            "<A:ACTIVE><font size='16'><p align='center'><a href='event:palta'><b>Palta</a></PT>",
  371.                            nil, 140, 160, 0, 30, 0x2B2B2B, 0x121212, 0.7, true)
  372.             ui.addTextArea(6,
  373.                            "<A:ACTIVE><font size='16'><p align='center'><a href='event:aguacate'><b>Aguacate</a></PT>",
  374.                            nil, 600, 160, 0, 30, 0x2B2B2B, 0x121212, 0.7, true)
  375.         elseif minigame == 17 then
  376.             message = "¡Haz click en todos los puntos!"
  377.             seconds = 16
  378.             cantidad = 10
  379.             clickTextareas(cantidad)
  380.         elseif minigame == 18 then
  381.             message = "¿En qué año se publicó Transformice?"
  382.         elseif minigame == 19 then
  383.             message = "¡Pon la bandera de Argentina!"
  384.         elseif minigame == 20 then
  385.             allWin()
  386.             seconds = 12
  387.             poscX, poscY, rotacion = math.random(10, 790),
  388.                                      math.random(150, 300), math.random(90, 120)
  389.             if poscX >= 400 then rotacion = rotacion * -1 end
  390.             message = "¡Esquiva los cañones!"
  391.         elseif minigame == 21 then
  392.             frase = math.random(1, #frases)
  393.             message = 'Escribe: "<R>' .. frases[frase] .. '</R>"'
  394.             seconds = 17
  395.         elseif minigame == 22 then
  396.             numMatarMax = 10
  397.             numMatar = math.random(1, numMatarMax)
  398.             message = "Escribe un número del <R>1</R> al <R>" .. numMatarMax ..
  399.                           "</R>"
  400.         elseif minigame == 23 then
  401.             message = "¡Pon la bandera de Chile!"
  402.         elseif minigame == 24 then
  403.             message = "¡Todos congelados!"
  404.             for nombre in pairs(players.alive) do
  405.                 if nombre ~= "_count" and tonumber(nombre) == nil then
  406.                     tfm.exec.freezePlayer(nombre)
  407.                 end
  408.             end
  409.             allWin()
  410.         elseif minigame == 25 then
  411.             tpEsquinas()
  412.             tfm.exec.addPhysicObject(66, 400, 311, {
  413.                 type = 1,
  414.                 width = 40,
  415.                 height = 48,
  416.                 friction = 0,
  417.                 restitution = 0.3,
  418.                 miceCollision = true,
  419.                 groundCollision = false,
  420.                 dynamic = false
  421.             })
  422.             message = "¡Quédate encima del hielo!"
  423.             porEncimaY = 273
  424.         elseif minigame == 26 then
  425.             message =
  426.                 "<font size='18'>¡Termina el mapa por encima de la línea roja!</font>"
  427.             ui.addTextArea(7, "", nil, 5, 210, 790, 12, 0xCA2020, 0xCA2020, 1,
  428.                            true)
  429.             tfm.exec.addShamanObject(26, 600, 50)
  430.             tfm.exec.addShamanObject(27, 200, 314)
  431.             porEncimaY = 210
  432.         elseif minigame == 27 then
  433.             message =
  434.                 "<font size='18'>¡Mantente a la derecha de la línea roja!</font>"
  435.             ui.addTextArea(7, "", nil, 388, 72, 12, 330, 0xCA2020, 0xCA2020, 1,
  436.                            true)
  437.             porEncimaX = 410
  438.         elseif minigame == 28 then
  439.             tfm.exec.addShamanObject(26, 550, 195)
  440.             tfm.exec.addShamanObject(27, 200, 314)
  441.             tfm.exec.addPhysicObject(66, 500, 200, {
  442.                 type = 1,
  443.                 width = 40,
  444.                 height = 50,
  445.                 friction = 0,
  446.                 restitution = 0.2,
  447.                 miceCollision = true,
  448.                 groundCollision = false,
  449.                 dynamic = false
  450.             })
  451.             porEncimaY = 160
  452.             message = "¡Quédate encima del hielo!"
  453.         elseif minigame == 29 then
  454.             message = "A mimir"
  455.         elseif minigame == 30 then
  456.             message = "Jueguen piedra papel o tijera"
  457.  
  458.         end -- end minigames dif0
  459.     elseif difficulty == 1 then -- MEDIUM
  460.         if not minigameManual then chooseMinigame(50, 68) end
  461.         seconds = 10
  462.         if minigame == 50 then
  463.             seconds = 13
  464.             numeroMinigame = math.random(1000000000, 10000000000) * 107
  465.             message = "Escribe este numero: <R>" .. numeroMinigame .. "</R>"
  466.         elseif minigame == 51 then
  467.             message = "¡Esquiva la lava!"
  468.             lavaW = 50
  469.             lavaH = 25
  470.             cantidadLava = 4
  471.             allWin()
  472.         elseif minigame == 52 then
  473.             message = "¡Haz click en todos los puntos!"
  474.             seconds = 21
  475.             cantidad = 20
  476.             clickTextareas(cantidad)
  477.         elseif minigame == 53 then
  478.             message = "¡Quédate CAMINANDO hacia la derecha!"
  479.         elseif minigame == 54 then
  480.             message = "¡Quédate CAMINANDO hacia la izquierda!"
  481.         elseif minigame == 55 then
  482.             message = "¡Salta en los últimos DOS segundos!"
  483.         elseif minigame == 56 then
  484.             message = "Si mandas un mensaje, ¡mueres!"
  485.             allWin()
  486.         elseif minigame == 57 then
  487.             message = "¡Eres más rápido hacia la izquierda!"
  488.             movIzq = true
  489.             allWin()
  490.         elseif minigame == 58 then
  491.             clicksToWin = 20
  492.             message = "¡Haz click en la pantalla <R>" .. clicksToWin ..
  493.                           "</R> veces!"
  494.         elseif minigame == 59 then
  495.             numMatarMax = 7
  496.             numMatar = math.random(1, numMatarMax)
  497.             message = "Escribe un número del <R>1</R> al <R>" .. numMatarMax ..
  498.                           "</R>"
  499.         elseif minigame == 60 then
  500.             message = "¡Empuja la caja fuera del mapa!"
  501.             seconds = 15
  502.             tfm.exec.addShamanObject(2, math.random(200, 600), 200, 0, 0, 0)
  503.             if players.alive._count >= 4 then
  504.                 tfm.exec.addShamanObject(2, math.random(200, 600), 200, 0, 0, 0)
  505.             end
  506.         elseif minigame == 61 then
  507.             seconds = 5
  508.             message = "¡Ven aquí!"
  509.             flechaX = math.random(150, 650)
  510.             tfm.exec.addShamanObject(0, flechaX, 285, 0, 0, 0)
  511.         elseif minigame == 62 then
  512.             tpEsquinas()
  513.             tfm.exec.addPhysicObject(66, 400, 311, {
  514.                 type = 1,
  515.                 width = 40,
  516.                 height = 48,
  517.                 friction = 0,
  518.                 restitution = 0.3,
  519.                 miceCollision = true,
  520.                 groundCollision = false,
  521.                 dynamic = false
  522.             })
  523.             tfm.exec.addPhysicObject(67, 400, 265, {
  524.                 type = 1,
  525.                 width = 20,
  526.                 height = 44,
  527.                 friction = 0,
  528.                 restitution = 0.3,
  529.                 miceCollision = true,
  530.                 groundCollision = false,
  531.                 dynamic = false
  532.             })
  533.             message = "¡Quedate encima del último hielo!"
  534.             porEncimaY = 230
  535.         elseif minigame == 63 then
  536.             message =
  537.                 "<font size='18'>¡Termina el mapa por encima de la línea roja!</font>"
  538.             ui.addTextArea(7, "", nil, 5, 150, 790, 12, 0xCA2020, 0xCA2020, 1,
  539.                            true)
  540.             tfm.exec.addShamanObject(26, 600, 50)
  541.             tfm.exec.addShamanObject(27, 200, 314)
  542.             porEncimaY = 141
  543.         elseif minigame == 64 then
  544.             seconds = 14
  545.             tfm.exec.addShamanObject(26, 200, 314)
  546.             tfm.exec.addPhysicObject(66, 500, 200, {
  547.                 type = 1,
  548.                 width = 40,
  549.                 height = 50,
  550.                 friction = 0,
  551.                 restitution = 0.2,
  552.                 miceCollision = true,
  553.                 groundCollision = false,
  554.                 dynamic = false
  555.             })
  556.             porEncimaY = 161
  557.             cont = 1
  558.             message = "¡Quédate encima del hielo!"
  559.         elseif minigame == 65 then
  560.             seconds = 16
  561.             message = "¡Esquiva los yunques o muere!"
  562.             tfm.exec.addShamanObject(0, 690, 300, 80, 0, 0)
  563.             allWin()
  564.         elseif minigame == 66 then
  565.             fuerza = 50
  566.             message = "¡Haz click para generar <R>una</R> explosión!"
  567.             for nombre in pairs(players.alive) do
  568.                 if nombre ~= "_count" and tonumber(nombre) == nil then
  569.                     player.info[nombre].explosions = 1
  570.                 end
  571.             end
  572.             allWin()
  573.         elseif minigame == 67 then
  574.             message = "¡El <R>ÚLTIMO</R> en hacer click muere!"
  575.             for nombre in pairs(players.alive) do
  576.                 if nombre ~= "_count" and tonumber(nombre) == nil then
  577.                     table.insert(lastClick, nombre)
  578.                 end
  579.             end
  580.             seconds = 6
  581.         elseif minigame == 68 then
  582.             message = "¡Ahora todos tienen pareja!"
  583.             parejas()
  584.             allWin()
  585.         elseif minigame == 69 then
  586.             allWin()
  587.             seconds = 22
  588.             poscX, poscY, rotacion = math.random(10, 790),
  589.                                      math.random(150, 300), math.random(90, 120)
  590.             if poscX >= 400 then rotacion = rotacion * -1 end
  591.             message = "¡Esquiva los cañones!"
  592.         end
  593.     elseif difficulty == 2 then -- HARD.
  594.         if not minigameManual then chooseMinigame(100, 107) end
  595.         seconds = 6
  596.         if minigame == 100 then
  597.             seconds = 8
  598.             numeroMinigame = math.random(5000000000, 10000000001) * 10007
  599.             message = "Escribe este numero: <R>" .. numeroMinigame .. "</R>"
  600.         elseif minigame == 101 then
  601.             message = "¡Haz click en todos los puntos!"
  602.             seconds = 21
  603.             cantidad = 30
  604.             clickTextareas(cantidad)
  605.         elseif minigame == 102 then
  606.             seconds = 21
  607.             message = "¡Esquiva la lava!"
  608.             lavaW = 70
  609.             lavaH = 25
  610.             cantidadLava = 5
  611.             allWin()
  612.         elseif minigame == 103 then
  613.             numMatarMax = 5
  614.             numMatar = math.random(1, numMatarMax)
  615.             message = "Escribe un número del <R>1</R> al <R>" .. numMatarMax ..
  616.                           "</R>"
  617.         elseif minigame == 104 then
  618.             seconds = 11
  619.             message = "¡Ven aquí y esquiva la lava!"
  620.             lavaW = 40
  621.             lavaH = 25
  622.             cantidadLava = 3
  623.             flechaX = math.random(150, 650)
  624.             tfm.exec.addShamanObject(0, flechaX, 285, 0, 0, 0)
  625.         elseif minigame == 105 then
  626.             message = "¡Salta en el <R>ÚLTIMO</R> segundos!"
  627.         elseif minigame == 106 then
  628.             message = "¡Ahora TODOS tienen queso!"
  629.             allWin()
  630.             for nombre in pairs(players.alive) do
  631.                 if nombre ~= "_count" and tonumber(nombre) == nil then
  632.                     tfm.exec.giveCheese(nombre)
  633.                 end
  634.             end
  635.         elseif minigame == 107 then
  636.             seconds = 10
  637.             allWin()
  638.             fuerza = 50
  639.             message = "¡Haz click para generar <R>dos</R> explosiones!"
  640.             for nombre in pairs(players.alive) do
  641.                 if nombre ~= "_count" and tonumber(nombre) == nil then
  642.                     player.info[nombre].explosions = 2
  643.                 end
  644.             end
  645.         elseif minigame == 108 then
  646.             allWin()
  647.             seconds = 22
  648.             poscX, poscY, rotacion = math.random(10, 790),
  649.                                      math.random(150, 300), math.random(90, 120)
  650.             if poscX >= 400 then rotacion = rotacion * -1 end
  651.             message = "¡Esquiva los cañones y las cajas!"
  652.         end
  653.  
  654.     elseif difficulty == 3 then -- EXPERT
  655.  
  656.     end
  657.     print("Minijuego: " .. minigame)
  658.     minigameManual = false
  659.     infoGame(message)
  660. end
  661.  
  662. eventTextAreaCallback = function(id, nombre, callback)
  663.     if callback == "cerrar" then
  664.         for i = 666, 668 do ui.removeTextArea(i, nombre) end
  665.     end
  666.     if not players.alive[nombre] then return end
  667.     if minigame == 16 then
  668.         if callback == "palta" then
  669.             player.info[nombre].team = "palta"
  670.             tfm.exec.chatMessage("¡Ahora estás en el equipo Palta!", nombre)
  671.         else
  672.             player.info[nombre].team = "aguacate"
  673.             tfm.exec
  674.                 .chatMessage("¡Ahora estás en el equipo Aguacate!", nombre)
  675.         end
  676.     elseif minigame == 17 or minigame == 52 or minigame == 101 then
  677.         if callback == 'clicksTextarea' then
  678.             ui.removeTextArea(id, nombre)
  679.             player.info[nombre].clicksTextareas =
  680.                 player.info[nombre].clicksTextareas + 1
  681.             if player.info[nombre].clicksTextareas >= cantidad then
  682.                 roundWin(nombre)
  683.             end
  684.         end
  685.     end
  686. end
  687.  
  688. meep = function(activo)
  689.     for nombre in pairs(players.alive) do
  690.         if nombre ~= "_count" and tonumber(nombre) == nil then
  691.             tfm.exec.giveMeep(nombre, activo)
  692.         end
  693.     end
  694. end
  695.  
  696. removeItem = function(myTable, key)
  697.     for i, keyTable in ipairs(myTable) do
  698.         if keyTable == key then table.remove(myTable, i) end
  699.     end
  700. end
  701.  
  702. rondaTerminada = function()
  703.     if minigame == 4 then
  704.         for nombre in pairs(players.alive) do
  705.             if nombre ~= "_count" and tonumber(nombre) == nil then
  706.                 if tfm.get.room.playerList[nombre].isFacingRight then
  707.                     roundWin(nombre)
  708.                 end
  709.             end
  710.         end
  711.     elseif minigame == 5 then
  712.         for nombre in pairs(players.alive) do
  713.             if nombre ~= "_count" and tonumber(nombre) == nil then
  714.                 if not tfm.get.room.playerList[nombre].isFacingRight then
  715.                     roundWin(nombre)
  716.                 end
  717.             end
  718.         end
  719.     elseif minigame == 16 then
  720.         contPalta = 0
  721.         contAguacate = 0
  722.         ui.removeTextArea(5, nil)
  723.         ui.removeTextArea(6, nil)
  724.         for nombre in pairs(players.alive) do
  725.             if nombre ~= "_count" and tonumber(nombre) == nil then
  726.                 if player.info[nombre].team == "palta" then
  727.                     contPalta = contPalta + 1
  728.                 elseif player.info[nombre].team == "aguacate" then
  729.                     contAguacate = contAguacate + 1
  730.                 end
  731.             end
  732.         end
  733.         if contPalta > contAguacate then
  734.             ganadorFruta = "Palta"
  735.         elseif contPalta < contAguacate then
  736.             ganadorFruta = "Aguacate"
  737.         else
  738.             ganadorFruta = "¡Empate!"
  739.         end
  740.         ui.addTextArea(7,
  741.                        "<BV><font size='20'><p align='center'><b>El ganador es: <R>" ..
  742.                            ganadorFruta .. "</R></BV>", nil, 150, 360, 500, 30,
  743.                        0x2B2B2B, 0x121212, 0.7, true)
  744.         for nombre in pairs(players.alive) do
  745.             if nombre ~= "_count" and tonumber(nombre) == nil then
  746.                 if (player.info[nombre].team == ganadorFruta:lower()) or
  747.                     ganadorFruta == "¡Empate!" then
  748.                     roundWin(nombre)
  749.                 end
  750.             end
  751.         end
  752.     elseif minigame == 22 or minigame == 59 or minigame == 103 then
  753.         for nombre in pairs(players.alive) do
  754.             if nombre ~= "_count" and tonumber(nombre) == nil then
  755.                 if player.info[nombre].numero ~= numMatar and
  756.                     player.info[nombre].numero > 0 then
  757.                     roundWin(nombre)
  758.                 end
  759.             end
  760.         end
  761.         ui.addTextArea(7,
  762.                        "<BV><font size='20'><p align='center'><b>¡Todos los números<R> " ..
  763.                            numMatar .. " </R>moriran!</BV>", nil, 150, 360, 500,
  764.                        30, 0x2B2B2B, 0x121212, 0.7, true)
  765.     elseif minigame == 24 then
  766.         for nombre in pairs(players.alive) do
  767.             if nombre ~= "_count" and tonumber(nombre) == nil then
  768.                 tfm.exec.freezePlayer(nombre, false)
  769.             end
  770.         end
  771.     elseif minigame == 25 or minigame == 62 or minigame == 26 or minigame == 63 or
  772.         minigame == 28 or minigame == 64 then
  773.         for nombre in pairs(players.alive) do
  774.             if nombre ~= "_count" and tonumber(nombre) == nil then
  775.                 if tfm.get.room.playerList[nombre].y <= porEncimaY then
  776.                     roundWin(nombre)
  777.                 end
  778.             end
  779.         end
  780.     elseif minigame == 27 then
  781.         for nombre in pairs(players.alive) do
  782.             if nombre ~= "_count" and tonumber(nombre) == nil then
  783.                 if tfm.get.room.playerList[nombre].x >= porEncimaX then
  784.                     roundWin(nombre)
  785.                 end
  786.             end
  787.         end
  788.     elseif minigame == 53 then
  789.         for nombre in pairs(players.alive) do
  790.             if nombre ~= "_count" and tonumber(nombre) == nil then
  791.                 if tfm.get.room.playerList[nombre].movingRight then
  792.                     roundWin(nombre)
  793.                 end
  794.             end
  795.         end
  796.     elseif minigame == 54 then
  797.         for nombre in pairs(players.alive) do
  798.             if nombre ~= "_count" and tonumber(nombre) == nil then
  799.                 if tfm.get.room.playerList[nombre].movingLeft then
  800.                     roundWin(nombre)
  801.                 end
  802.             end
  803.         end
  804.     elseif minigame == 61 or minigame == 104 then
  805.         for nombre in pairs(players.alive) do
  806.             if nombre ~= "_count" and tonumber(nombre) == nil then
  807.                 if not (tfm.get.room.playerList[nombre].x - 30 > flechaX or
  808.                     tfm.get.room.playerList[nombre].x + 30 < flechaX) then
  809.                     roundWin(nombre)
  810.                 end
  811.             end
  812.         end
  813.     elseif minigame == 60 then
  814.         for _, k in pairs(tfm.get.room.objectList) do
  815.             if (k.type == 2) and (k.y < 310 == false) then
  816.                 allWin()
  817.             else
  818.                 for nombre in pairs(players.alive) do
  819.                     if nombre ~= "_count" and tonumber(nombre) == nil then
  820.                         player.info[nombre].roundWin = false
  821.                     end
  822.                 end
  823.             end
  824.         end
  825.     end
  826.     minigame = 0
  827.  
  828.     for nombre in pairs(players.alive) do
  829.         if nombre ~= "_count" and tonumber(nombre) == nil then -- agregar al array kilLPlayers todos los jugadores que no hayan termiando la ronda.
  830.             if not player.info[nombre].roundWin then
  831.                 table.insert(killPlayers, nombre)
  832.             end
  833.         end
  834.     end
  835.  
  836.     for _, nombre in pairs(killPlayers) do -- los mata, y los elimina de playersAlive
  837.         remove(players.alive, nombre)
  838.         tfm.exec.killPlayer(nombre)
  839.     end
  840.  
  841.     killPlayers = {}
  842.     ui.removeTextArea(1, nil)
  843.     timeNewRound = os.time()
  844.  
  845.     if players.alive._count == 1 then
  846.         for nombre in pairs(players.alive) do
  847.             if nombre ~= "_count" and tonumber(nombre) == nil then
  848.                 ganador(nombre)
  849.             end
  850.         end
  851.         alreadyWinner = true
  852.     elseif players.alive._count < 1 then
  853.         allDead = true
  854.         ui.addTextArea(7,
  855.                        "<BV><font size='20'><p align='center'><b>¡Nadie gana! ¡Todos muertos!",
  856.                        nil, 150, 200, 500, 30, 0x2B2B2B, 0x121212, 0.7, true)
  857.     end
  858.  
  859. end
  860.  
  861. eventEmotePlayed = function(nombre, idEmote, bandera)
  862.     print(idEmote)
  863.     if not players.alive[nombre] then return end
  864.     if minigame == 10 and idEmote == 0 then
  865.         roundWin(nombre)
  866.     elseif minigame == 19 and idEmote == 10 and bandera == "ar" then
  867.         roundWin(nombre)
  868.     elseif minigame == 23 and idEmote == 10 and bandera == "cl" then
  869.         roundWin(nombre)
  870.     elseif minigame == 29 and idEmote == 6 then
  871.         roundWin(nombre)
  872.     elseif minigame == 30 and idEmote == 25 or idEmote == 26 then
  873.         roundWin(nombre)
  874.     end
  875. end
  876.  
  877. allWin = function()
  878.     for nombre in pairs(players.alive) do
  879.         if nombre ~= "_count" and tonumber(nombre) == nil then
  880.             player.info[nombre].roundWin = true
  881.         end
  882.     end
  883. end
  884.  
  885. eventLoop = function()
  886.     --[[ playersWin = 0
  887.   for nombre in pairs(players.alive) do
  888.     if nombre ~= "_count" and tonumber(nombre) == nil then
  889.         if player.info[nombre].roundWin then
  890.             playersWin = playersWin + 1
  891.         end
  892.     end
  893.   end
  894.  
  895.   print("Vivos: " .. players.alive._count .. " PlayerWins: " .. playersWin .. " En sala: " .. players.room._count) ]]
  896.  
  897.     counter = counter + 1 -- cada 0.5s el contador aumenta en 1
  898.     if counter >= 2 and seconds > 0 then -- si pasó 1s entonces..
  899.         seconds = seconds - 1 -- se resta 1s
  900.         ui.updateTextArea(0,
  901.                           "<R><font size='20'><p align='center'>" .. seconds ..
  902.                               "</R>", nil) -- se actualiza el textarea
  903.         counter = 0
  904.         if minigame == 2 or minigame == 51 or minigame == 102 or minigame == 104 then
  905.             counterMinigames = counterMinigames + 1
  906.             if counterMinigames >= 3 then
  907.                 for k = 1, cantidadLava do
  908.                     rainLava(k, lavaW, lavaH)
  909.                 end
  910.                 counterMinigames = 0
  911.             end
  912.         elseif minigame == 20 or minigame == 69 or minigame == 108 then
  913.             counterMinigames = counterMinigames + 1
  914.             if counterMinigames == 1 then
  915.                 tfm.exec
  916.                     .addShamanObject(0, poscX - 7, poscY - 7, rotacion + 180)
  917.             elseif counterMinigames >= 2 then
  918.                 spawnearCn()
  919.                 if minigame == 108 then
  920.                     counterMinigames2 = counterMinigames2 + 1
  921.                     if counterMinigames2 >= 2 then
  922.                         tfm.exec.addShamanObject(2, math.random(200, 600), 200,
  923.                                                  0, 0, 0)
  924.                         counterMinigames2 = 0
  925.                     end
  926.                 end
  927.             end
  928.         elseif minigame == 64 then
  929.             tfm.exec.addShamanObject(27, posPortalX[cont], 195)
  930.             cont = cont + 1
  931.         elseif minigame == 65 then
  932.             counterMinigames = counterMinigames + 1
  933.             if counterMinigames >= 3 then
  934.                 tfm.exec.addShamanObject(10, 670, 300, -10, -20)
  935.                 counterMinigames = 0
  936.             end
  937.         end
  938.         if seconds == 0 then rondaTerminada() end
  939.     end
  940.  
  941.     if timeNewRound < os.time() - 5000 then
  942.         timeNewRound = 9999999999999
  943.         if alreadyWinner or allDead then
  944.             newMap()
  945.             ui.removeTextArea(7, nil)
  946.             alreadyWinner = false
  947.             allDead = false
  948.         else
  949.             newRound()
  950.         end
  951.     end
  952. end
  953.  
  954. spawnearCn = function()
  955.     tfm.exec.addShamanObject(math.random(1701, 1714), poscX, poscY, rotacion,
  956.                              10, 10)
  957.     counterMinigames = 0
  958.     poscX, poscY, rotacion = math.random(10, 790), math.random(150, 300),
  959.                              math.random(90, 120)
  960.     if poscX >= 400 then rotacion = rotacion * -1 end
  961. end
  962.  
  963. rainLava = function(id, lavaWidht, lavaHeigth)
  964.     tfm.exec.addPhysicObject(id, math.random(130, 670), 0, {
  965.         type = 3,
  966.         width = lavaWidht,
  967.         height = lavaHeigth,
  968.         friction = 0.2,
  969.         angle = math.random(10, 80),
  970.         restitution = 9999,
  971.         miceCollision = true,
  972.         groundCollision = false,
  973.         dynamic = true,
  974.         fixedRotation = true,
  975.         mass = 10,
  976.         linearDamping = 1
  977.     })
  978. end
  979.  
  980. eventChatCommand = function(nombre, comando)
  981.     if not admin[nombre] then return end
  982.     local args = {}
  983.     for argument in comando:gmatch("[^%s]+") do table.insert(args, argument) end
  984.     if args[1]:lower():lower() == "respawn" or args[1]:lower() == "r" then
  985.         tfm.exec.respawnPlayer(args[2] or nombre)
  986.     elseif (args[1]:lower() == "dif" or args[1]:lower() == "dificultad" or
  987.         args[1]:lower() == "d") and tonumber(args[2]) ~= nil then
  988.         difficulty = tonumber(args[2])
  989.     elseif (args[1]:lower() == "minigame" or args[1]:lower() == "m" or
  990.         args[1]:lower() == "minijuego") and tonumber(args[2]) ~= nil then
  991.         minigame = tonumber(args[2])
  992.         minigameManual = true
  993.         -- Se coloca automaticamente la dificultad del minijuego en concreto:
  994.         if minigame >= 1 and minigame < 50 then
  995.             difficulty = 0
  996.         elseif minigame >= 50 and minigame < 100 then
  997.             difficulty = 1
  998.         elseif minigame >= 100 and minigame < 150 then
  999.             difficulty = 2
  1000.         elseif minigame >= 150 and minigame < 200 then
  1001.             difficulty = 3
  1002.         end
  1003.         timeNewRound = 9999999999999
  1004.         newRound()
  1005.     end
  1006. end
  1007.  
  1008. eventKeyboard = function(nombre, key, down, posX, posY)
  1009.     if not players.alive[nombre] then return end
  1010.     if (minigame == 6) and (key == 40 or key == 83) and
  1011.         (not tfm.get.room.playerList[nombre].isDead) then -- Se coloca entre () la primera condición para que si alguna de las dos es true pase a la siguiente.
  1012.         tfm.exec.killPlayer(nombre)
  1013.         tfm.exec.addShamanObject(90, posX, posY)
  1014.     elseif (minigame == 7) and (key == 38 or key == 87 or key == 90) then
  1015.         tfm.exec.killPlayer(nombre)
  1016.     elseif (minigame == 8) and
  1017.         (key == 38 or key == 39 or key == 37 or key == 87 or key == 90 or key ==
  1018.             40 or key == 83 or key == 65 or key == 68 or key == 81) then
  1019.         tfm.exec.killPlayer(nombre)
  1020.     elseif minigame == 9 and key == 69 then
  1021.         player.info[nombre].countE = player.info[nombre].countE + 1
  1022.         if player.info[nombre].countE >= 5 then roundWin(nombre) end
  1023.     elseif movIzq and (key == 37 or key == 65 or key == 81) then
  1024.         tfm.exec.movePlayer(nombre, 0, 0, true, -50, 0, true)
  1025.     elseif (minigame == 13) and (key == 39 or key == 68) then
  1026.         tfm.exec.killPlayer(nombre)
  1027.     elseif (minigame == 14) and (key == 37 or key == 81 or key == 65) then
  1028.         tfm.exec.killPlayer(nombre)
  1029.     elseif minigame == 55 and (key == 38 or key == 87 or key == 90) then
  1030.         if seconds <= 2 then
  1031.             roundWin(nombre)
  1032.         else
  1033.             tfm.exec.killPlayer(nombre)
  1034.         end
  1035.     elseif minigame == 105 and (key == 38 or key == 87 or key == 90) then
  1036.         if seconds <= 1 then
  1037.             roundWin(nombre)
  1038.         else
  1039.             tfm.exec.killPlayer(nombre)
  1040.         end
  1041.     end
  1042. end
  1043.  
  1044. ganador = function(nombre)
  1045.     ui.addTextArea(7,
  1046.                    "<BV><font size='20'><p align='center'><b>¡<R>" .. nombre ..
  1047.                        "</R> ganó la partida!", nil, 150, 200, 500, 30,
  1048.                    0x2B2B2B, 0x121212, 0.7, true)
  1049.     tfm.exec.setPlayerScore(nombre, 1, true)
  1050. end
  1051.  
  1052. newMap = function()
  1053.     counter = 0
  1054.     seconds = 6
  1055.     rounds = 0
  1056.     difficulty = 0
  1057.     timeNewRound = os.time() -- + 15000 -- Empieza con 15s (+5s que tarda en iniciar la ronda) extras
  1058.     lastClick = {}
  1059.     tfm.exec.newGame('7773692')
  1060.     tfm.exec.setGameTime(100000)
  1061.     gameStarted = false
  1062.     minigame = 0
  1063.     cleanMap()
  1064.     stats()
  1065. end
  1066.  
  1067. newMap()
  1068.  
  1069.  
Add Comment
Please, Sign In to add comment