Advertisement
alditojeje

Untitled

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