Advertisement
alditojeje

lua blood

Jan 3rd, 2020
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.18 KB | None | 0 0
  1. -- cuando ponen !copiarhistorial que no se abra el historial, explosion personalizada, tamaño funcorp
  2. local adm = {
  3. ['Blood#3565'] = true,
  4. ['Anto#6095'] = true,
  5. ['His#0439'] = true,
  6. ['Alditohacker#0000'] = true,
  7. ['Beckham#0977'] = true,
  8. ['Kiwi#8872'] = true,
  9. ['Noob#5388'] = true
  10. }
  11. local fly = {}
  12. local speed = {}
  13. respawn = true
  14. args = {}
  15. historialMapas = {}
  16. historial = {}
  17. historialActivos = {}
  18. recordsActivos = {}
  19. times = {}
  20. comandosUsados = {}
  21. categoria = '#17'
  22. mapVanilla = 0
  23. player = {info = {checkpoint = {}}, poderes = {}}
  24. checkpoints = false
  25. str = "\n<textformat tabstops='[70, 170, 300]'>"
  26.  
  27. function colorReyes()
  28. tfm.exec.setNameColor('Anto#6095', 0xFFA8D3)
  29. tfm.exec.setNameColor('Blood#3565', 0xCA2411)
  30. tfm.exec.setNameColor('Noob#5388', 0x67D8EF)
  31. end
  32.  
  33. function teclas()
  34. for i, k in pairs(tfm.get.room.playerList) do
  35. tfm.exec.bindKeyboard(i, 32, false, true)
  36. tfm.exec.bindKeyboard(i, 46, false, true)
  37. tfm.exec.bindKeyboard(i, 80, false, true)
  38. tfm.exec.bindKeyboard(i, 76, false, true)
  39. tfm.exec.bindKeyboard(i, 16, false, true)
  40. tfm.exec.bindKeyboard(i, 77, false, true)
  41. tfm.exec.bindKeyboard(i, 69, false, true)
  42. tfm.exec.bindKeyboard(i, 8, false, true)
  43. player.info[i] = {poderes = {false, true, false}}
  44. print(player.info[i].poderes[2])
  45. end
  46. end
  47.  
  48. teclas()
  49.  
  50.  
  51. tfm.exec.disableAfkDeath(true)
  52. tfm.exec.disableAutoScore(true)
  53. tfm.exec.disableAutoShaman(true)
  54. tfm.exec.disableAutoTimeLeft(true)
  55. tfm.exec.disableAutoNewGame(true)
  56. system.disableChatCommandDisplay(nil)
  57. colorReyes()
  58.  
  59.  
  60. --[[function activarPoderes(playerName, poder)
  61. if poder == "fly" then
  62. print(player.info[playerName].poderes[2])
  63. end
  64. end]]
  65.  
  66. function eventChatCommand(name, command)
  67. args = string.split(command, ' ')
  68. if command == 'ayuda' or command == 'help' then
  69. pagina = 1
  70. texto =
  71. '<br><b><R>Comandos para mapas:</R><br></b><CE>!np</CE><V> [categoria]</V> - Cambia a un mapa de la categoria escogida. (ejemplo: !np p5)<br><CE>!np </CE><V>[code]</V> - Cambia al mapa escogido. (ejemplo: !np @7415814)<br><CE>!historial</CE> - Muestra el historial de los mapas jugados.<br><br><b><R>Comandos de habilidades:</R></b><br><CE>!fly</CE> - Activa/desactiva el poder de volar.<br><CE>!speed</CE> - Activa/desactiva el poder de volar<br><CE>!tp</CE> - Activa el poder de teletransportarse.<br><CE>!nofly</CE> o <CE>!nospeed</CE> o <CE>!notp</CE> - Desactiva el poder elegido.<br><CE>!all</CE> - Activa todos los poderes.'
  72. ayuda(name)
  73. elseif command == 'comandos' then
  74. verComandos(name)
  75. elseif command == 'historial' then
  76. if historial[name] then
  77. for i, v in ipairs(historialActivos) do
  78. if name == v then
  79. table.remove(historialActivos, i)
  80. end
  81. end
  82. historial[name] = false
  83. else
  84. table.insert(historialActivos, name)
  85. historial[name] = true
  86. end
  87. historialMaps(name)
  88. end
  89. if args[1] == 'mort' then tfm.exec.killPlayer(name) end
  90. if adm[name] then
  91. if args[1] == 'queso' or args[1] == 'cheese' or args[1] == 'q' then
  92. tfm.exec.giveCheese(args[2] or name)
  93. elseif args[1] == 'noc' or args[1] == 'noq' then
  94. tfm.exec.removeCheese(args[2] or name)
  95. elseif args[1] == 'win' then
  96. tfm.exec.giveCheese(args[2] or name)
  97. tfm.exec.playerVictory(args[2] or name)
  98. elseif args[1] == 'sfacil' then
  99. tfm.exec.setShaman(args[2] or name)
  100. tfm.exec.setShamanMode(args[2] or name, 0)
  101. elseif args[1] == 'shard' then
  102. tfm.exec.setShaman(args[2] or name)
  103. tfm.exec.setShamanMode(args[2] or name, 1)
  104. elseif args[1] == 'sdivine' then
  105. tfm.exec.setShaman(args[2] or name)
  106. tfm.exec.setShamanMode(args[2] or name, 2)
  107. elseif args[1] == 's' or args[1] == 'shaman' then
  108. tfm.exec.setShaman(args[2] or name)
  109. elseif args[1] == 'nos' or args[1] == 'noshaman' then
  110. tfm.exec.setShaman(args[2] or name, false)
  111. elseif args[1] == 'kill' then
  112. tfm.exec.killPlayer(args[2] or name)
  113. elseif args[1] == 'tp' then
  114. system.bindMouse(name, true)
  115. elseif args[1] == 'notp' then
  116. system.bindMouse(name, false)
  117. elseif args[1] == "checkpoints" then
  118. if checkpoints then
  119. checkpoints = false
  120. else
  121. checkpoints = true
  122. end
  123. elseif args[1] == "fly" then
  124. --activarPoderes(name, args[1])
  125. -- if player.info[name].poderes[2] then
  126.  
  127. -- print("desactivado")
  128. --else
  129. -- print("activado")
  130. --end
  131. if fly[name] then
  132. fly[name] = false
  133. else
  134. fly[name] = true
  135. end
  136. elseif args[1] == 'nofly' then
  137. elseif command == 'ar' or command == 'activerespawn' or command ==
  138. 'activer' or command == 'arespawn' then
  139. if respawn then
  140. respawn = false
  141. else
  142. respawn = true
  143. end
  144. elseif command == 'sp' or command == 'speed' then
  145. tfm.exec.bindKeyboard(name, 90, false, true)
  146. tfm.exec.bindKeyboard(name, 88, false, true)
  147. if speed[name] then
  148. speed[name] = false
  149. else
  150. speed[name] = true
  151. end
  152. elseif command == 'all' or command == 'powers' or command == 'poderes' then
  153. fly[name] = true
  154. tfm.exec.bindKeyboard(name, 32, false, true)
  155. system.bindMouse(name, true)
  156. speed[name] = true
  157. tfm.exec.bindKeyboard(name, 90, false, true)
  158. tfm.exec.bindKeyboard(name, 88, false, true)
  159. elseif args[1] == 'congelar' then
  160. tfm.exec.freezePlayer(args[2] or name, true)
  161. elseif args[1] == 'descongelar' then
  162. tfm.exec.freezePlayer(args[2] or name, false)
  163. elseif command == 'copiarhistorial' then
  164. historialMaps(name)
  165. copiarHistorial = historialM:gsub('<br>', ', ')
  166. print('<BV> Historial de mapas:</BV>')
  167. print('<V>' .. copiarHistorial .. '</V>')
  168. elseif args[1] == 'np' then
  169. if args[2] == nil then
  170. tfm.exec.newGame('#7', false)
  171. else
  172. args[2] = args[2]:gsub('p', '#')
  173. tfm.exec.newGame(args[2], false)
  174. end
  175. elseif args[1] == 'respawn' or args[1] == 'r' then
  176. tfm.exec.respawnPlayer(args[2] or name)
  177. elseif args[1] == "xml" then
  178. -- by bolodefchoco
  179. local xml, current = tfm.get.room.xmlMapInfo.xml, 0
  180. xml = xml:gsub("<", "*"):gsub(",0,", ",,")
  181. print("<R>" .. tfm.get.room.currentMap .. " XML:")
  182. while #xml > current do
  183. current = current + 3001
  184. print("<R>" .. xml:sub(current - 3000, current):gsub("*", "&lt;"))
  185. end
  186. end
  187. end
  188. table.insert(comandosUsados, 1, {usuario = name, comandoUsado = command})
  189. end
  190.  
  191. function historialMaps(name)
  192. historialM = ''
  193. for i = 1, #historialMapas do
  194. historialM = '@' .. historialMapas[i] .. historialM
  195. end
  196. if historial[name] == false then
  197. ui.removeTextArea(100, name)
  198. else
  199. ui.addTextArea(100,
  200. "<p align='center'><VP>Historial Mapas<VP> <CS><br>" ..
  201. historialM, name, -150, 3, 100, 0, 0x2B2B2B,
  202. 0x121212, 0.8, true)
  203. end
  204. end
  205.  
  206. function eventMouse(name, x, y)
  207. if system.bindMouse then
  208. tfm.exec.movePlayer(name, x, y, false, 0, 0, false)
  209. end
  210. end
  211.  
  212. function records(nombre)
  213. if recordsActivos[nombre] then
  214. ui.removeTextArea(40, nombre)
  215. ui.removeTextArea(41, nombre)
  216. else
  217. ui.addTextArea(40, str, nombre, 275, 80, 250, 200, 0x2B2B2B, 0x121212,
  218. 1, true)
  219. ui.addTextArea(41,
  220. "<p align='center'><font size ='13' color='#00C17C'><b>Tiempos",
  221. nombre, 352, 65, 100, 20, 0x2B2B2B, 0x121212, 1, true)
  222. end
  223. end
  224.  
  225. function verComandos(player)
  226. comandos = "<textformat tabstops='[70, 170, 300]'>"
  227. for i, completion in ipairs(comandosUsados) do
  228. comandos = comandos ..
  229. ('[' .. completion.usuario .. '] - !' ..
  230. completion.comandoUsado .. '\n')
  231. end
  232. comandos = comandos .. '</textformat>'
  233. ui.addTextArea(50,
  234. '<b><br><br>01<br>02<br>03<br>04<br>05<br>06<br>07<br>08<br>09<br>10<br>11<br>12<br>13<br>14<br>15<br>16<br>17',
  235. player, 155, 71, 500, 250, 0x1E1E1E, 0x121212, 1, true)
  236. ui.addTextArea(51,
  237. "<p align='center'><font size ='17' color='#00C17C'><b>Historial de Comandos",
  238. player, 216, 67, 400, 25, 0, 0, 1, true)
  239. ui.addTextArea(52,
  240. "<p align='center'><V><a href='event:cerrarComandos'><font size='14' color='#F93018'><b>X",
  241. player, 640, 69, 0, 0, 0, 0, 1, true)
  242. ui.addTextArea(53, comandos, player, 182, 96, 450, 213, 0x2E2E2E, 0x121212,
  243. 1, true)
  244. end
  245.  
  246. function eventKeyboard(name, key, down, x, y)
  247. if key == 32 and fly[name] == true then
  248. tfm.exec.movePlayer(name, 0, 0, true, 0, -50, false)
  249. elseif key == 90 and speed[name] == true then
  250. tfm.exec.movePlayer(name, 0, 0, true, -100, 0, false)
  251. elseif key == 88 and speed[name] == true then
  252. tfm.exec.movePlayer(name, 0, 0, true, 100, 0, false)
  253. elseif key == 46 or key == 16 then
  254. tfm.exec.killPlayer(name)
  255. elseif key == 77 and adm[name] then
  256. tfm.exec.newGame(mapVanilla)
  257. mapVanilla = mapVanilla + 1
  258. elseif key == 80 and adm[name] then
  259. tfm.exec.newGame(categoria)
  260. table.insert(comandosUsados, 1, {
  261. usuario = name,
  262. comandoUsado = "Presionó la tecla " .. key
  263. })
  264.  
  265. elseif key == 76 then
  266. if recordsActivos[name] then
  267. recordsActivos[name] = false
  268. else
  269. recordsActivos[name] = true
  270. end
  271. records(name)
  272. elseif key == 69 and checkpoints then
  273. cheese = tfm.get.room.playerList[name].hasCheese
  274. player.info[name].checkpoint = {true, x, y, cheese}
  275. ui.addTextArea(456, "", name, x, y, 5, 5, 0xFFFD93, 0x121212, 0.4,
  276. true)
  277. elseif key == 8 then
  278. player.info[name].checkpoint = {false, 0, 0, false}
  279. ui.removeTextArea(456, name)
  280. end
  281. end
  282.  
  283. for nombre, p in pairs(tfm.get.room.playerList) do recordsActivos[nombre] = true end
  284.  
  285. function eventPlayerWon(playerName, tiempoRonda, tiempoRespawn)
  286. if respawn then
  287. tfm.exec.respawnPlayer(playerName)
  288. colorReyes()
  289. end
  290. tfm.exec.setPlayerScore(playerName, 1, true)
  291. str = "\n<textformat tabstops='[70, 170, 300]'>"
  292. table.insert(times, {time = tiempoRespawn / 100, name = playerName})
  293. table.sort(times, function(i, v) return i.time < v.time end)
  294. for i, completion in ipairs(times) do
  295. if i <= 15 then
  296. if i < 10 then i = 0 .. i end
  297. str = str ..
  298. (i .. ' | ' .. completion.name .. '\t| ' ..
  299. completion.time .. 's\n')
  300. end
  301. end
  302. str = str .. '</textformat>'
  303. for nombre, p in pairs(tfm.get.room.playerList) do records(nombre) end
  304. end
  305.  
  306. function eventNewGame()
  307. posicion = 0
  308. first = true
  309. times = {}
  310. str = "\n<textformat tabstops='[70, 170, 300]'>"
  311. mapActual = tfm.get.room.xmlMapInfo.mapCode .. '<br>'
  312. table.insert(historialMapas, mapActual)
  313. colorReyes()
  314. tiempos = {}
  315. tiempoJugador = {}
  316. for nombre, p in pairs(tfm.get.room.playerList) do
  317. for k, nombreHistorial in pairs(historialActivos) do
  318. if nombre == nombreHistorial then historialMaps(nombre) end
  319. end
  320. -- player.info[nombre] = {poderes = {false, true, false}}
  321. player.info[nombre] = {checkpoint = {false, 0, 0, false}}
  322. ui.removeTextArea(456, nombre)
  323. end
  324. end
  325.  
  326. function ayuda(name)
  327. ui.addTextArea(0, texto, name, 200, 80, 400, 200, 0x2B2B2B, 0x121212, 1,
  328. true)
  329. ui.addTextArea(1,
  330. "<p align='center'><font size ='13' color='#00C17C'><b>Ayuda",
  331. name, 350, 65, 100, 20, 0x2B2B2B, 0x121212, 1, true)
  332. ui.addTextArea(2,
  333. "<p align='center'><V><a href='event:cerrar'><font size='14' color='#F93018'><b>X",
  334. name, 583, 78, 0, 0, 0, 0, 1, true)
  335. ui.addTextArea(3,
  336. "<p align='center'><V><a href='event:paginaSiguiente'><font size='14'><b>»",
  337. name, 560, 288, 40, 20, 0x2B2B2B, 0x121212, 1, true)
  338. ui.addTextArea(4,
  339. "<p align='center'><V><a href='event:paginaAnterior'><font size='14'><b>«",
  340. name, 514, 288, 40, 20, 0x2B2B2B, 0x121212, 1, true)
  341. ui.addTextArea(5,
  342. "<p align='center'><font size ='13' color='#00C17C'><b>" ..
  343. pagina .. '/3', name, 200, 288, 50, 20, 0x2B2B2B,
  344. 0x121212, 1, true)
  345. end
  346.  
  347. function eventTextAreaCallback(id, name, callBack)
  348. if callBack == 'cerrar' then
  349. for i = 0, 17, 1 do ui.removeTextArea(i, name) end
  350. elseif callBack == 'paginaSiguiente' then
  351. if pagina <= 2 then pagina = pagina + 1 end
  352. if pagina == 2 then
  353. texto =
  354. '<br><b><R>Comandos de chamán:</R></b><br><CE>!s</CE><V> [nombreJugador]</V> - El jugador será chamán con su modo actual.<br><CE>!sfacil</CE><V> [nombreJugador]</V> - El jugador será chamán en modo fácil.<br><CE>!shard</CE><V> [nombreJugador] </V>- El jugador será chamán en modo díficil.<br><CE>!sdivine</CE><V> [nombreJugador]</V> - El jugador será chamán en modo divino.<br><br><b><R>Comandos útiles:</R><br></b><CE>!ayuda</CE> - Abre esta ventana.<br><CE>!queso</CE><V> [nombreJugador]</V> - Da queso al jugador.<br><CE>!noqueso </CE><V>[nombreJugador]</V> - Remueve el queso del jugador.<br><CE>!win</CE><V> [nombreJugador]</V> - El jugador ganará el mapa.<br><CE>!respawn</CE> <V>[nombreJugador]</V> - Respawnea al jugador.<br><CE>!arespawn</CE> - Activa/desactiva el autorespawn.'
  355. elseif pagina == 1 then
  356. texto =
  357. '<br><b><R>Comandos para mapas:</R><br></b><CE>!np</CE><V> [categoria]</V> - Cambia a un mapa de la categoria escogida. (ejemplo: !np p5)<br><CE>!np </CE><V>[code]</V> - Cambia al mapa escogido. (ejemplo: !np @7415814)<br><CE>!historial</CE> - Muestra el historial de los mapas jugados.<br><br><b><R>Comandos de habilidades:</R></b><br><CE>!fly</CE> - Activa/desactiva el poder de volar.<br><CE>!speed</CE> - Activa/desactiva el poder de volar<br><CE>!tp</CE> - Activa el poder de teletransportarse.<br><CE>!nofly</CE> o <CE>!nospeed</CE> o <CE>!notp</CE> - Desactiva el poder elegido.<br><CE>!all</CE> - Activa todos los poderes.'
  358. elseif pagina == 3 then
  359. texto =
  360. "<br><b><R>Otros comandos:</R><br></b><CE>!copiarhistorial</CE> - La lista de todos los mapas jugados apareceran en el chat #lua. [sólo valido para la persona que este ejecutando el lua]<br><br><b><R><font size = '13'>Nota</font></R></b><br>La mayoría de los comandos tienen su propia abreviatura, como por ejemplo escribir <CE>!r</CE><V> [nombreJugador]</V> es lo mismos que escribir <CE>!respawn</CE><V> [nombreJugador]</V>, o también <CE>!nof </CE>equivale a <CE>!nofly</CE>, etc."
  361. end
  362. ayuda(name)
  363. elseif callBack == 'paginaAnterior' then
  364. if pagina >= 2 then pagina = pagina - 1 end
  365. if pagina == 2 then
  366. texto =
  367. '<br><b><R>Comandos de chamán:</R></b><br><CE>!s</CE><V> [nombreJugador]</V> - El jugador será chamán con su modo actual.<br><CE>!sfacil</CE><V> [nombreJugador]</V> - El jugador será chamán en modo fácil.<br><CE>!shard</CE><V> [nombreJugador] </V>- El jugador será chamán en modo díficil.<br><CE>!sdivine</CE><V> [nombreJugador]</V> - El jugador será chamán en modo divino.<br><br><b><R>Comandos útiles:</R><br></b><CE>!ayuda</CE> - Abre esta ventana.<br><CE>!queso</CE><V> [nombreJugador]</V> - Da queso al jugador.<br><CE>!noqueso </CE><V>[nombreJugador]</V> - Remueve el queso del jugador.<br><CE>!win</CE><V> [nombreJugador]</V> - El jugador ganará el mapa.<br><CE>!respawn</CE> <V>[nombreJugador]</V> - Respawnea al jugador.<br><CE>!arespawn</CE> - Activa/desactiva el autorespawn.'
  368. elseif pagina == 1 then
  369. texto =
  370. '<br><b><R>Comandos para mapas:</R><br></b><CE>!np</CE><V> [categoria]</V> - Cambia a un mapa de la categoria escogida. (ejemplo: !np p5)<br><CE>!np </CE><V>[code]</V> - Cambia al mapa escogido. (ejemplo: !np @7415814)<br><CE>!historial</CE> - Muestra el historial de los mapas jugados.<br><br><b><R>Comandos de habilidades:</R></b><br><CE>!fly</CE> - Activa/desactiva el poder de volar.<br><CE>!speed</CE> - Activa/desactiva el poder de volar<br><CE>!tp</CE> - Activa el poder de teletransportarse.<br><CE>!nofly</CE> o <CE>!nospeed</CE> o <CE>!notp</CE> - Desactiva el poder elegido.<br><CE>!all</CE> - Activa todos los poderes.'
  371. end
  372. ayuda(name)
  373. elseif callBack == 'cerrarComandos' then
  374. for i = 50, 53 do ui.removeTextArea(i, name) end
  375. end
  376. end
  377.  
  378. function eventNewPlayer(jugador)
  379. teclas()
  380. recordsActivos[jugador] = true
  381. tfm.exec.respawnPlayer(jugador)
  382. ui.addTextArea(15,
  383. "<p align='center'><V><a href='event:settings'><font color='#C2C2DA'><b>?",
  384. jugador, 3, -22, 20, 0, 0x3C5064, 0x2D3C4B, 1, true)
  385. player.info[jugador] = {checkpoint = {false, 0, 0, false}}
  386. -- player.info[nombre] = {checkpoint = {false, 0, 0, false}}
  387. end
  388.  
  389. function eventPlayerDied(playerName)
  390. if respawn then
  391. tfm.exec.respawnPlayer(playerName)
  392. if player.info[playerName].checkpoint[1] and checkpoints then
  393. tfm.exec.movePlayer(playerName,
  394. player.info[playerName].checkpoint[2],
  395. player.info[playerName].checkpoint[3])
  396. if player.info[playerName].checkpoint[4] then
  397. tfm.exec.giveCheese(playerName)
  398. end
  399. end
  400. colorReyes()
  401. end
  402. end
  403.  
  404. function eventPlayerLeft (playerName)
  405. print(player.info[playerName].checkpoint[1])
  406. end
  407.  
  408. ui.addTextArea(15,
  409. "<p align='center'><V><a href='event:settings'><font color='#C2C2DA'><b>?",
  410. nil, 5, -22, 20, 0, 0x3C5064, 0x2D3C4B, 1, true)
  411.  
  412. function string.split(s, pattern, n)
  413. local st = {}
  414. for sb in string.gmatch(s, '[^' .. pattern .. ']+') do
  415. if not n or n > -1 then
  416. table.insert(st, sb)
  417. else
  418. st[#st] = st[#st] .. pattern .. sb
  419. end
  420. n = n and n - 1 or false
  421. end
  422. return st
  423. end
  424.  
  425. tfm.exec.newGame('#7', false)
  426.  
  427.  
  428. -- @2007205@505109
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement