Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ Disable ]]--
- for _, v in next, {'AutoShaman', 'AutoNewGame', 'AutoTimeLeft', 'PhysicalConsumables', 'AfkDeath', 'AutoScore'} do
- tfm.exec['disable' .. v]()
- end
- for _, v in next, {'r', 'rank', 'ranking', 'lang', 'langue', 'help', 'ajuda', 'ayuda', 'ban', 'kick', 'unban', 'unkick', 'powerup', 'unrank'} do
- system.disableChatCommandDisplay(v)
- end
- -- [[ Script Data ]]--
- local data = {
- -- Table
- staff = {
- -- Admin > !ban/!kick !unban/unkick !unrank
- ['Bolodefchoco#0000'] = 1,
- ['Fly#8215'] = 1,
- ['Rianmojang1#0000'] = 1
- },
- player = {
- list = {},
- winner = ''
- },
- block = {
- list = {
- [1] = {
- isFrozen = false,
- countdown = os.time(),
- -- Ground properties
- type = 12,
- width = 50,
- height = 50,
- x = 1000,
- y = -250
- },
- [2] = {
- isFrozen = false,
- countdown = os.time(),
- -- Ground properties
- type = 12,
- width = 50,
- height = 50,
- x = 1000,
- y = -250
- }
- },
- increaseTick = {
- [30] = 10,
- [60] = 15,
- [80] = 20,
- [120] = 50,
- [160] = 30,
- [200] = 30,
- [220] = 40
- },
- },
- powerup = {
- traps = {},
- currentType = '',
- x = 0,
- y = 0
- },
- map = {
- list = {
- '@7465700', '@7473420', '@7483324', '@7484233', '@7482735', '@7483285', '@7483941', '@7483593', '@7470110', '@7470116', '@7261057', '@7470071', '@7470134', '@7471243', '@7472054', '@7473526', '@7472834', '@7472869', '@7478945', '@7482067', '@7474073', '@7483681', '@6595400', '@7482735', '@7483593', '@6986307'
- },
- height, width = 800, 400
- },
- -- Number
- currentTime = 0,
- -- String
- img = '',
- -- Boolean
- isTribeHouse = (tfm.get.room.name:find(string.char(3)) and true or false)
- }
- -- Set a function for each power up in list
- data.powerup.list = {
- meep = function(n)
- tfm.exec.giveMeep(n)
- end,
- trap = function(n, x, y)
- local obj = tfm.exec.addShamanObject(68, x, y)
- data.powerup.traps[#data.powerup.traps + 1] = {obj, os.time()}
- local target = targetSelect()
- data.player.list[target[1]].target = 1
- tfm.exec.movePlayer(n, x, y)
- end,
- imortal = function(n)
- data.player.list[n].immortality = {true, os.time()}
- end,
- decrease = function()
- data.block.list[1].width, data.block.list[1].height = (data.block.list[1].width - 20), (data.block.list[1].height - 20)
- end,
- explosion = function(n, x, y)
- tfm.exec.explosion(x, y, 200, 60)
- tfm.exec.displayParticle(12, x, y)
- end,
- teleport = function(n)
- tfm.exec.movePlayer(n, math.random(20, (data.map.width - 40)), math.random(20, (data.map.height - 40)))
- end,
- freeze = function()
- local target = targetSelect()
- for i = 1, #target do
- data.block.list[i].isFrozen = true
- data.block.list[i].countdown = os.time()
- end
- end,
- clone = function()
- local w, h = (data.block.list[1].width / 2), (data.block.list[1].height / 2)
- data.block.list[1].width, data.block.list[1].height = w, h
- data.block.list[2].width, data.block.list[2].height = w, h
- data.block.list[2].x, data.block.list[2].y = data.block.list[1].x, data.block.list[1].y
- randomPlayer(2)
- data.block.list[2].countdown = os.time()
- end,
- time = function()
- tfm.exec.setGameTime((data.currentTime + 30), true)
- end
- }
- local translations = {
- ['br'] = {
- block = "O Bloco aumentou de tamanho! :O",
- help = "<p align='center'><font size='20'><B><J>Ajuda</font></J>\n\n<font size='13'>Seu objetivo neste jogo é bem simples, corra o mais rapido que puder do bloco assasino. Pegue Powerups para te ajudar a sobreviver. Tome cuidado com as armadilhas dentro dos blocos. :P<BR><J>Envie mapas para nós!<BR><VP><a href='event:mapsLink'>atelier801.com/topic?f=819406&t=924082</a>",
- powerups = "<J>Atualmente existem <CE>9</CE> powerups:</J><BR><VP>Immortality -- <N>Imortalidade por 10 segundos<BR><VP>Trap -- <N>Te prende em uma armadilha<BR><VP>Meep -- <N>Te da MEEP<BR><VP>Decrase -- <N>Diminui o bloco em 20x20<BR><VP>Explosion -- <N>O bloco de powerup explode<BR><VP>Teleport -- <N>Te teleporta em algum lugar aleatório do mapa<BR><VP>Freeze -- <N>Congela o bloco por 10 segundos<BR><VP>Clone -- <N>Clona o bloco<BR><VP>Time -- <N>Adiciona 30s na partida",
- help_title = "<font size='16'><p align='center'><a href='event:openhelp'><VP>Ajuda",
- welcome = "<ROSE>Seja bem vindo ao Block<BR><VP>Versão Beta v2.0.<BR><N>Digite <J>!help</CE> para mais informações.<BR><J>Quer ver seu mapa aparecendo? Envie para nós avaliarmos em:<BR><VP>https://atelier801.com/topic?f=819406&t=924082",
- caughtPowerup = "<CE><VP>%s</VP> pegou o PowerUp <VP>%s</VP>",
- targetBlock = "Alvo do bloco: <b><v>",
- targetBlocks = "Alvos: <b><v>",
- credits = "<p align='center'><font size='20'><B><CE>Créditos</font></CE>\n\n<font size='11'><p align='left'><CE>Desenvolvedores</CE>: Rianmojang1#0000 e Fly#8215\n\n<J>Essas outras pessoas ajudaram a testar o jogo, em mapas ou em alguma parte do Script: </J>Bodykudo#0000, Madaryagah#0000,<BR>Contistente#0000, Pro#1435",
- credits_title = "<font size='16'><p align='center'><a href='event:opencredits'><VP>Créditos",
- rankingRoom = "Sala",
- rankingName = "Nome",
- rankingWins = "Vitórias",
- rankingRounds = "Rodadas",
- rankingPosition = "Pos.",
- rankingMessage = "<ROSE>O ranking não é global, os dados atuais são dessa única sala.<BR>Rodadas e vitórias contam a partir de 6 jogadores.",
- noWinner = "Ninguém venceu",
- win = "venceu",
- banMessage = "<p align=\"center\"><font size=\"32\">Você foi banido!\nSerá desbanido em: <CE>%s</CE> segundos.\n Motivo:%s",
- breakRules = "Quebrou as regras"
- },
- ['en'] = {
- block = "The block increased in size! :O",
- help = "<p align='center'><font size='20'><B><J>Help</font></J>\n\n<font size='13'>Your aim in this minigame is simple: run as fast as you can and avoid the murderer ground. Collect powerups that help you survive. Take care with the traps inside the powerup block. :P<BR><J>Send maps!<BR><VP><a href='event:mapsLink'>atelier801.com/topic?f=819406&t=924082</a>",
- powerups = "<J>There are currently <CE>9</CE> powerups:</J><BR><VP>Immortality -- <N>Makes you imortal for 10 seconds<BR><VP>Trap -- <N>Puts you in a trap<BR><VP>Meep -- <N>Gives you MEEP<BR><VP>Decrase -- <N>Decreases the ground to 20x20<BR><VP>Explosion -- <N>The powerup ground explodes<BR><VP>Teleport -- <N>Teleports you to a random location in the map.<BR><VP>Freeze -- <N>Freezes the block for 10 seconds.<BR><VP>Clone -- <N>Clones the block<BR><VP>Time -- <N>Adds 30s in game",
- help_title = "<font size='16'><p align='center'><a href='event:openhelp'><VP>Help",
- welcome = "<ROSE>Welcome to the module Block<BR><VP>Beta Version v2.0.<BR><N>Type <J>!help</CE> to read more about the minigame.<BR><J>Want to see your map here? Send it here: <BR><VP>https://atelier801.com/topic?f=819406&t=924082",
- caughtPowerup = "<CE><VP>%s</VP> got a PowerUp <VP>%s</VP>",
- targetBlock = "Block target: <b><v>",
- targetBlocks = "Targets: <b><v>",
- credits = "<p align='center'><font size='20'><B><CE>Credits</font></CE>\n\n<font size='11'><p align='left'><CE>Developers</CE>: Rianmojang1#0000 and Fly#8215\n\n<J>These people helped testing the module, sending maps or coding the game: </J>Bodykudo#0000, Madaryagah#0000,<BR>Contistente#0000, Pro#1435",
- credits_title = "<font size='16'><p align='center'><a href='event:opencredits'><VP>Credits",
- rankingRoom = "Room",
- rankingName = "Name",
- rankingWins = "Wins",
- rankingRounds = "Rounds",
- rankingPosition = "Pos.",
- rankingMessage = "<ROSE>The ranking isn't global, the current data are from this single room.<BR>Rounds and wins counts from 6 players in the room.",
- noWinner = "No one won",
- win = "won",
- banMessage = "<p align=\"center\"><font size=\"32\">You are banned!\nYou will be able to play in: <CE>%s</CE> seconds. Reason:%s",
- breakRules = "Broken rules"
- },
- ['es'] = {
- block = "El bloque aumentó de tamaño! :O",
- help = "<p align='center'><font size='20'><B><J>Help</font></J>\n\n<font size='13'>Tu objetivo en este minijuego es simple: corre lo más rápido que puedas del bloque asesino. Recolecta potenciadores que te ayudarán a sobrevivir. Ten cuidado con las trampas dentro de los powerups. :P<BR><J>¡Envía mapas para el módulo!<BR><VP><a href='event:mapsLink'>atelier801.com/topic?f=819406&t=924082</a>",
- powerups = "<J>Actualmente existen <CE>9</CE> powerups:</J><BR><VP>Immortality -- <N>Te hace inmortal durante 10 segundos<BR><VP>Trap -- <N>Te coloca sobre una trampa<BR><VP>Meep -- <N>Te otorga el MEEP<BR><VP>Decrase -- <N>Disminuye el suelo a 20x20<BR><VP>Explosión -- <N>La superficie del potenciador explota<BR><VP>Teleport -- <N>Te teletransporta a una ubicación aleatoria en el mapa.<BR><VP>Freeze -- <N>Congela el bloque por 10 segundos<BR><VP>Clone -- <N>Clona el bloque<N><BR><VP>Time -- <N>Agrega 30 segundos en el juego<BR>",
- help_title = "<font size='16'><p align='center'><a href='event:openhelp'><VP>Ayuda",
- welcome = "<ROSE>Bienvenido al módulo Block<BR><VP>Versión Beta v2.0.<BR><N>Escribe <J>!help</CE> para saber más del minijuego.<BR><J>¿Quieres ver tu mapa en el módulo? Envíalo aquí: <BR><VP>https://atelier801.com/topic?f=819406&t=924082",
- caughtPowerup = "<CE> <VP>%s </VP> obtuvieron un PowerUp <VP>%s</VP>",
- targetBlock = "Objetivo del bloque: <b><v>",
- targetBlocks = "Objetivos: <b><v>",
- credits = "<p align='center'><font size='20'><B><CE>Créditos</font></CE>\n\n<font size='11'><p align='left'><CE>Desarrolladores</CE>: Rianmojang1#0000 e Fly#8215\n\n<J>Estas personas han ayudado probando el módulo, enviando mapas o con códigos: </J>Bodykudo#0000, Madaryagah#0000,<BR>Contistente#0000, Pro#1435",
- credits_title = "<font size='16'><p align='center'><a href='event:opencredits'><VP>Créditos",
- rankingRoom = "Sala",
- rankingName = "Nombre",
- rankingWins = "Victorias",
- rankingRounds = "Rodadas",
- rankingPosition = "Pos.",
- rankingMessage = "<ROSE>El ranking no es global, los datos actuales provienen de esta única sala.<BR>Las rondas y victorias cuentan a partir de 6 jugadores en la sala.",
- noWinner = "Nadie ganó",
- win = "ganó",
- banMessage = "<p align=\"center\"><font size=\"32\">Estás prohibido de jugar!\nSe le permitirá jugar en: <CE>%s</CE> segundos. Razón:%s",
- breakRules = "Reglas rotas"
- },
- ['fr'] = {
- block = "Le bloc a augnenté en taille! :O",
- help = "<p align='center'><font size='20'><B><J>Aide</font></J>\n\n<font size='13'>Votre but dans ce mini-jeu est simple: courez ausse vite que vous pouzes et éviter le bloc. Rassemblez les powerups qui vous aide à survivre.<BR><J>Envoyez des cartes au module!<BR><VP><a href='event:mapsLink'>atelier801.com/topic?f=819406&t=924082</a>",
- powerups = "<J>Il y a actuellement <CE>9</CE> powerups:</J><BR><VP>Immortality -- <N>Vous devenez immortel pendant 10 secondes<BR><VP>Trap -- <N>Vous met dans un piège<BR><VP>Meep -- <N>Vous donne le MEEP<BR><VP>Decrase -- <N>Diminue le bloc à 20x20<BR><VP>Explosion -- <N>Eclate le powerup du bloc<BR><VP>Teleport -- <N>Vous téléporte à un emplacement aléatoire dans la carte<BR><VP>Freeze -- <N>Gèle le bloc pendant 10 secondes<BR><VP>Clone -- <N>Clone le bloc<BR><VP>Time -- <N>Ajoute 30 secondes dans le jeu",
- help_title = "<font size='16'><p align='center'><a href='event:openhelp'><VP>Aide",
- welcome = "<ROSE>Bienvenue sur le module #Block!<BR><N>Tapez <J>!help</CE> pour plus en savoir sur le mini-jeu.<BR><J>Vous voulez voir votre carte ici? Envoyes ici:<BR><VP>https://atelier801.com/topic?f=819406&t=924082",
- caughtPowerup = "<CE><VP>%s</VP> a obtenu le powerup <VP>%s</VP>",
- targetBlock = "Cible du bloc: <b><v>",
- targetBlocks = "Ciles: <b><v>",
- credits = "<p align='center'><font size='20'><B><CE>Crédits</font></CE>\n\n<font size='11'><p align='left'><CE>Développeurs</CE>: Rianmojang1#0000 & Fly#8215\n\n<J>Ces personnes ont aidé à tester le module, à envoyer des cartes ou à coder certaines choses: </J>Bodykudo#0000, Madaryagah#0000,<BR>Contistente#0000, Pro#1435",
- credits_title = "<font size='16'><p align='center'><a href='event:opencredits'><VP>Crédits",
- rankingRoom = "Salon",
- rankingName = "Pseudo",
- rankingWins = "Victoires",
- rankingRounds = "Tour",
- rankingPosition = "Pos.",
- rankingMessage = "<ROSE>Le classement n'est pas mondial, les données actuelles sont seulement de ce salon.<BR>Les tours et les victoires comptent à 6 joueurs dans le salon.",
- noWinner = "Personne n'a gagné",
- win = "gagné",
- banMessage = "<p align=\"center\"><font size=\"32\">You are banned!\nVous êtes banni! Vous pourrez rejouer danz: <CE>%s</CE> secondes. Raison:%s",
- breakRules = "Enfreint les règles"
- }
- }
- translations['pt'] = translations['br']
- -- [[ Function Lib ]] --
- function distance(x1, y1, x2, y2, range)
- local dx = (x1 - x2)
- local dy = (y1 - y2)
- return math.sqrt(dx * dx + dy * dy) <= range
- end
- function split(t,s)
- local a = {}
- for k, v in string.gmatch(t, string.format("[^%s]+", s or "%s")) do
- table.insert(a, k)
- end
- return a
- end
- function targetSelect()
- local t = {}
- for k, v in next, data.player.list do
- if (v.target ~= 0) then
- t[#t + 1] = k
- end
- end
- return t
- end
- function translate(name, key)
- local lang = (data.player.list[name] and data.player.list[name].lang or tfm.get.room.community)
- lang = (translations[lang] and lang or 'en')
- return translations[lang][key] or nil
- end
- function banWarning(name)
- if (data.player.list[name].ban) then
- if (data.player.list[name].banTime > 0) then
- ui.addTextArea(999, '', name, 5, 0, 800, 400, 0x000000, 0x000001, 1, true)
- ui.addTextArea(1000, string.format(translate(name, 'banMessage'), math.ceil(data.player.list[name].banTime), data.player.list[name].banReason), name, 100, 138, 586, nil, 0x324650, 0x000000, 0, true)
- else
- data.player.list[name].ban = false
- data.player.list[name].banReason = ''
- ui.removeTextArea(999, name); ui.removeTextArea(1000, name)
- end
- else
- ui.removeTextArea(999, name); ui.removeTextArea(1000, name)
- end
- end
- function showTarget(name)
- local t = targetSelect()
- if (#t > 0) then
- local key = (#t > 1 and 'targetBlocks' or 'targetBlock')
- local str = (key == 'targetBlock' and t[1] or t[1] .. ' & ' .. t[2])
- ui.addTextArea(100, "<p align='center'><font size='12'>" .. translate(name, key) .. str, name, 5, 25, nil, 21, 0x0e3142, 0x000001, .9, true)
- end
- end
- function randomPlayer(key)
- local list = {}
- for k, v in next, data.player.list do
- if (tfm.get.room.playerList[k] and not tfm.get.room.playerList[k].isDead) then
- if (v.target == 0) then
- list[#list + 1] = k
- elseif (v.target == key) then
- v.target = 0
- end
- end
- end
- local p = list[math.random(#list)] -- Selected player
- if (p) then
- data.player.list[p].target = key
- end
- table.foreach(tfm.get.room.playerList, showTarget)
- end
- function showRanking(name)
- data.player.list[name].openrank = true
- local t = {'', '', '', '', {}}
- local pos = 1
- local room = tfm.get.room.name
- for k, v in next, data.player.list do
- if (v.wins > 0) then
- t[5][#t[5] + 1] = {k, v.wins, v.rounds}
- end
- end
- table.sort(t[5], function(a, b) return a[2] > b[2] end)
- if (pos < 10) then
- for i = 1, #t[5] do
- local nick = t[5][i][1]
- local tag = nick:sub(nick:find('#'), #nick)
- local wins = t[5][i][2]
- local rounds = t[5][i][3]
- t[1] = t[1] .. '#' .. pos .. '\n'
- t[2] = t[2] .. nick:sub(1, nick:find('#') - 1) .. "<font size='9'><g>" .. tag .. '</g></font>\n'
- t[3] = t[3] .. wins .. '\n'
- t[4] = t[4] .. rounds .. '\n'
- pos = (pos + 1)
- end
- end
- ui.addTextArea(50, "", name, 191, 53, 441, 282, 0x183442, 0x183442, 1, true)
- ui.addTextArea(51, "", name, 458, 153, 59, 166, 0x7d8d99, 0x000000, 1, true)
- ui.addTextArea(52, "", name, 290, 153, 129, 166, 0x7d8d99, 0x050505, 1, true)
- ui.addTextArea(53, "", name, 292, 155, 129, 166, 0x7d8d99, 0x7d8d99, 1, true)
- ui.addTextArea(54, "", name, 460, 155, 59, 166, 0x7d8d99, 0x7d8d99, 1, true)
- ui.addTextArea(55, "", name, 458, 153, 59, 166, 0x7d8d99, 0x000000, 1, true)
- ui.addTextArea(56, "", name, 550, 154, 59, 166, 0x7d8d99, 0x000000, 1, true)
- ui.addTextArea(57, "<p align='center'><font size='16'>" .. translate(name, 'rankingPosition'), name, 203, 123, 56, 30, 0x324650, 0x000000, 0, true) -- Position
- ui.addTextArea(58, "<p align='center'><font size='16'>" .. translate(name, 'rankingName'), name, 292, 123, 129, 30, 0x324650, 0x000000, 0, true) -- Name
- ui.addTextArea(59, "<p align='center'><font size='16'>" .. translate(name, 'rankingWins'), name, 447, 123, 80, 30, 0x324650, 0x000000, 0, true) -- Wins
- ui.addTextArea(60, "<p align='center'><font size='16'>" .. translate(name, 'rankingRounds'), name, 541, 123, 80, 30, 0x324650, 0x000000, 0, true) -- Rounds
- ui.addTextArea(61, "", name, 211, 155, 44, 166, 0x7d8d99, 0x7d8d99, 1, true)
- ui.addTextArea(62, "", name, 209, 153, 44, 166, 0x0b1d26, 0x000000, 1, true)
- ui.addTextArea(63, "", name, 552, 155, 59, 166, 0x7d8d99, 0x7d8d99, 1, true)
- ui.addTextArea(64, "", name, 550, 153, 59, 166, 0x7d8d99, 0x000000, 1, true)
- ui.addTextArea(65, "<p align='center'><font size='40'>Ranking", name, 312, 50, 194, nil, 0x324650, 0x000000, 0, true)
- ui.addTextArea(66, "<p align='center'><font size='12'>" .. translate(name, 'rankingRoom') .. " : " .. room, name, 191, 102, 441, nil, 0x183442, 0x183442, 0, true) -- Room
- ui.addTextArea(67, "<p align='center'><font size='13'>" .. t[4], name, 551, 154, 59, 166, 0x0b1d26, 0x0b1d26, 1, true)
- ui.addTextArea(68, "<p align='center'><font size='13'>" .. t[3], name, 459, 154, 59, 166, 0x0b1d26, 0x0b1d26, 1, true)
- ui.addTextArea(69, "<p align='center'><font size='13'>" .. t[1], name, 210, 154, 44, 166, 0x0b1d26, 0x0b1d26, 1, true)
- ui.addTextArea(70, "<p align='center'><font size='13'>" .. t[2], name, 291, 154, 129, 166, 0x0b1d26, 0x0b1d26, 1, true)
- ui.addTextArea(71, "<font size='20'><R><a href='event:closerank'>✖", name, 607, 50, 32, 43, 0x324650, 0x000000, 0, true)
- tfm.exec.chatMessage(translate(name, 'rankingMessage'), name)
- end
- function showHelp(name)
- data.player.list[name].openhelp = true
- ui.addTextArea(0, "", name, 5, 24, 791, 385, 0x000001, 0x000000, 0.7, true)
- ui.addTextArea(1, "", name, 438, 127, 106, 25, 0x052636, 0x000000, 1, true)
- ui.addTextArea(2, "", name, 171, 116, 454, 217, 0x0a1d26, 0x7d8d99, 1, true)
- ui.addTextArea(3, "", name, 175, 119, 454, 217, 0x0a1d26, 0x000000, 1, true)
- ui.addTextArea(4, "", name, 172, 117, 454, 217, 0x0a1d26, 0x0a1d26, 1, true)
- ui.addTextArea(5, "", name, 341, 123, 106, 25, 0x052636, 0x7d8d99, 1, true)
- ui.addTextArea(6, "", name, 481, 123, 106, 25, 0x052636, 0x7d8d99, 1, true)
- ui.addTextArea(7, "", name, 201, 123, 106, 25, 0x052636, 0x7d8d99, 1, true)
- ui.addTextArea(8, "", name, 203, 125, 106, 26, 0x052636, 0x000000, 1, true)
- ui.addTextArea(9, "", name, 343, 127, 106, 25, 0x052636, 0x000000, 1, true)
- ui.addTextArea(10, "", name, 484, 126, 106, 25, 0x052636, 0x000000, 1, true)
- ui.addTextArea(11, "<font size='16'><p align='center'><a href='event:openpowerups'><VP>Powerups", name, 482, 124, 106, 25, 0x052636, 0x052636, 1, true)
- ui.addTextArea(12, translate(name, 'help_title'), name, 202, 124, 106, 25, 0x052636, 0x052636, 1, true)
- ui.addTextArea(13, translate(name, 'credits_title'), name, 342, 124, 106, 25, 0x052636, 0x052636, 1, true)
- ui.addTextArea(14, translate(name, 'help'), name, 182, 169, 438, 160, 0x0a2c3d, 0x0a2c3d, 1, true)
- ui.addTextArea(15, "<font size='20'><R><a href='event:closehelp'>X", name, 608, 118, 28, 34, 0x324650, 0x000000, 0, true)
- end
- function showCredits(name)
- data.player.list[name].openhelp = true
- ui.addTextArea(0, "", name, 5, 24, 791, 385, 0x000001, 0x000000, 0.7, true)
- ui.addTextArea(1, "", name, 438, 127, 106, 25, 0x052636, 0x000000, 1, true)
- ui.addTextArea(2, "", name, 171, 116, 454, 217, 0x0a1d26, 0x7d8d99, 1, true)
- ui.addTextArea(3, "", name, 175, 119, 454, 217, 0x0a1d26, 0x000000, 1, true)
- ui.addTextArea(4, "", name, 172, 117, 454, 217, 0x0a1d26, 0x0a1d26, 1, true)
- ui.addTextArea(5, "", name, 341, 123, 106, 25, 0x052636, 0x7d8d99, 1, true)
- ui.addTextArea(6, "", name, 481, 123, 106, 25, 0x052636, 0x7d8d99, 1, true)
- ui.addTextArea(7, "", name, 201, 123, 106, 25, 0x052636, 0x7d8d99, 1, true)
- ui.addTextArea(8, "", name, 203, 125, 106, 26, 0x052636, 0x000000, 1, true)
- ui.addTextArea(9, "", name, 343, 127, 106, 25, 0x052636, 0x000000, 1, true)
- ui.addTextArea(10, "", name, 484, 126, 106, 25, 0x052636, 0x000000, 1, true)
- ui.addTextArea(11, "<font size='16'><p align='center'><a href='event:openpowerups'><VP>Powerups", name, 482, 124, 106, 25, 0x052636, 0x052636, 1, true)
- ui.addTextArea(12, translate(name, 'help_title'), name, 202, 124, 106, 25, 0x052636, 0x052636, 1, true)
- ui.addTextArea(13, translate(name, 'credits_title'), name, 342, 124, 106, 25, 0x052636, 0x052636, 1, true)
- ui.addTextArea(14, translate(name, 'credits'), name, 182, 169, 438, 160, 0x0a2c3d, 0x0a2c3d, 1, true)
- ui.addTextArea(15, "<font size='20'><R><a href='event:closehelp'>X", name, 608, 118, 28, 34, 0x324650, 0x000000, 0, true)
- end
- function showPowerups(name)
- data.player.list[name].openhelp = true
- ui.addTextArea(0, "", name, 5, 24, 791, 385, 0x000001, 0x000000, 0.7, true)
- ui.addTextArea(1, "", name, 438, 127, 106, 25, 0x052636, 0x000000, 1, true)
- ui.addTextArea(2, "", name, 171, 116, 454, 217, 0x0a1d26, 0x7d8d99, 1, true)
- ui.addTextArea(3, "", name, 175, 119, 454, 217, 0x0a1d26, 0x000000, 1, true)
- ui.addTextArea(4, "", name, 172, 117, 454, 217, 0x0a1d26, 0x0a1d26, 1, true)
- ui.addTextArea(5, "", name, 341, 123, 106, 25, 0x052636, 0x7d8d99, 1, true)
- ui.addTextArea(6, "", name, 481, 123, 106, 25, 0x052636, 0x7d8d99, 1, true)
- ui.addTextArea(7, "", name, 201, 123, 106, 25, 0x052636, 0x7d8d99, 1, true)
- ui.addTextArea(8, "", name, 203, 125, 106, 26, 0x052636, 0x000000, 1, true)
- ui.addTextArea(9, "", name, 343, 127, 106, 25, 0x052636, 0x000000, 1, true)
- ui.addTextArea(10, "", name, 484, 126, 106, 25, 0x052636, 0x000000, 1, true)
- ui.addTextArea(11, "<font size='16'><p align='center'><a href='event:openpowerups'><VP>Powerups", name, 482, 124, 106, 25, 0x052636, 0x052636, 1, true)
- ui.addTextArea(12, translate(name, 'help_title'), name, 202, 124, 106, 25, 0x052636, 0x052636, 1, true)
- ui.addTextArea(13, translate(name, 'credits_title'), name, 342, 124, 106, 25, 0x052636, 0x052636, 1, true)
- ui.addTextArea(14, translate(name, 'powerups'), name, 182, 169, 438, 160, 0x0a2c3d, 0x0a2c3d, 1, true)
- ui.addTextArea(15, "<font size='20'><R><a href='event:closehelp'>X", name, 608, 118, 28, 34, 0x324650, 0x000000, 0, true)
- end
- function newMap(map)
- local code = (map or '')
- if (code ~= '') then
- tfm.exec.newGame(map)
- else
- repeat
- code = data.map.list[math.random(#data.map.list)]
- until
- code ~= tfm.get.room.currentMap
- end
- data.block.list[1].x, data.block.list[1].y = 1000, -250
- data.block.list[1].width, data.block.list[1].height = 50, 50
- for k, v in next, data.player.list do
- if (v.target ~= 0) then
- v.target = 0
- end
- end
- if (code ~= '') then
- tfm.exec.newGame(code)
- end
- end
- newMap()
- function randomColor()
- return math.random(0xFFFFFF)
- end
- function setPowerup(type)
- local i
- local list = {}
- for k, v in next, data.powerup.list do
- list[#list + 1] = k
- end
- local chance = 160
- local chance = math.random(chance)
- if (chance <= 20) then -- Meep -> 20% chance
- i = 1
- elseif (chance <= 40) then -- Imortal -> 20% chance
- i = 2
- elseif (chance <= 60) then -- Clone -> 20% chance
- i = 3
- elseif (chance <= 80) then -- Decrease -> 20% chance
- i = 4
- elseif (chance <= 100) then -- Explosion -> 20% chance
- i = 5
- elseif (chance <= 115) then -- Teleport -> 15% chance
- i = 6
- elseif (chance <= 130) then -- Freeze -> 15% chance
- i = 7
- elseif (chance <= 145) then -- Clone -> 15% chance
- i = 8
- elseif (chance <= 160) then -- Time -> 15% chance
- i = 9
- end
- if (type) then
- i = (list[tonumber(type)] and tonumber(type) or i)
- end
- data.powerup.currentType = list[i]
- local x, y = data.map.width, data.map.height
- data.powerup.x = (math.random(0, x))
- data.powerup.y = (math.random(0, y))
- if (data.img ~= '') then
- tfm.exec.removeImage(data.img)
- data.img = ''
- end
- data.img = tfm.exec.addImage("164a5bd1079.png","!999", tonumber(data.powerup.x), tonumber(data.powerup.y))
- --ui.addTextArea(201, "<p align='center'><font size='20' color='#FFFFFF' face='Impact'>", nil, data.powerup.x, data.powerup.y, 30, 30, 0xFFD700, 0xFFD700, 1, false)
- end
- function update()
- local target = targetSelect()
- local p = #target
- for i = 1, #target do
- local x, y = tfm.get.room.playerList[target[i]] and tfm.get.room.playerList[target[i]].x or nil, tfm.get.room.playerList[target[i]] and tfm.get.room.playerList[target[i]].y or nil
- if (x and y) then
- if (not data.block.list[i].isFrozen) then
- if (x > data.block.list[i].x) then
- data.block.list[i].x = (data.block.list[i].x + 30)
- else
- data.block.list[i].x = (data.block.list[i].x - 30)
- end
- if (y > data.block.list[i].y) then
- data.block.list[i].y = (data.block.list[i].y + 30)
- else
- data.block.list[i].y = (data.block.list[i].y - 30)
- end
- else
- data.block.list[i].type = 1
- end
- if (data.block.list[i].countdown < os.time() - 10000) then
- for k, v in next, data.player.list do
- if (v.target == i) then
- v.target = 0
- p = (p - 1)
- end
- end
- if (i ~= 2) then
- randomPlayer(i)
- else
- data.block.list[i].x, data.block.list[i].y = 1000, -250
- tfm.exec.removePhysicObject(i)
- table.foreach(tfm.get.room.playerList, showTarget)
- end
- data.block.list[i].countdown = os.time()
- data.block.list[i].isFrozen = false
- data.block.list[i].type = 12
- end
- else
- randomPlayer(i)
- end
- end
- for i = 1, p do
- tfm.exec.addPhysicObject(i, data.block.list[i].x, data.block.list[i].y, {
- type = data.block.list[i].type,
- width = data.block.list[i].width,
- height = data.block.list[i].height,
- color = randomColor()
- })
- end
- end
- -- [[ TFM Api ]] --
- function eventNewPlayer(name)
- tfm.exec.lowerSyncDelay(name)
- if (not data.player.list[name]) then
- data.player.list[name] = {
- rounds = 0,
- wins = 0,
- ban = false,
- banTime = 0,
- banReason = '',
- hide = false,
- openrank = false,
- openhelp = false,
- target = 0,
- immortality = {false, os.time()},
- lang = tfm.get.room.playerList[name].community
- }
- end
- local keys = {0, 2, 32, 72, 76} -- Left Key, Right Key, Spacebar, H, L
- for k, v in next, keys do
- system.bindKeyboard(name, v, true)
- end
- tfm.exec.chatMessage(translate(name, 'welcome'), name)
- end
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
- function eventChatCommand(name, cmd)
- local arg = split(cmd, " ")
- local perm = (data.staff[name] or 666)
- -- [[ Public ]] --
- if (arg[1] == "help" or arg[1] == "ajuda" or arg[1] == "como" or arg[1] == "ayuda") then
- showHelp(name)
- elseif (arg[1] == "creditos" or arg[1] == "Creditos" or arg[1] == "Credits" or arg[1] == "credits") then
- showCredits(name)
- elseif (arg[1] == "rank" or arg[1] == "r" or arg[1] == 'ranking') then
- showRanking(name)
- elseif (arg[1] == 'lang' or arg[1] == 'langue' or arg[1] == 'lingua') then
- if (arg[2]) then
- arg[2] = arg[2]:lower()
- data.player.list[name].lang = (translations[arg[2]] and arg[2] or data.player.list[name].lang)
- end
- -- [[ Priv8 ]] --
- elseif (arg[1] == 'np' or arg[1] == 'map' or arg[1] == 'mapa') then
- if (perm <= 2) then
- if (arg[2]) then
- newMap(arg[2])
- else
- newMap()
- end
- end
- elseif (arg[1] == 'ban' or arg[1] == 'kick') then
- if (perm == 1) then
- local player
- if (arg[2]) then
- player = arg[2]:lower():gsub('%a', string.upper, 1)
- if (data.player.list[player] and not data.staff[player]) then
- data.player.list[player].banTime = 0
- if (arg[3]) then
- local t = tonumber(arg[3])
- t = (t > 0 and t or 60*5)
- data.player.list[player].banTime = t
- else
- data.player.list[player].banTime = (60*5)
- end
- if (arg[4]) then
- for i = 4, #arg do
- data.player.list[player].banReason = data.player.list[player].banReason .. arg[i] .. (i ~= #arg and ' ' or '')
- end
- else
- data.player.list[player].banReason = translate(player, 'breakRules')
- end
- data.player.list[player].ban = true
- banWarning(player)
- tfm.exec.killPlayer(player)
- end
- end
- end
- elseif (arg[1] == 'unban' or arg[1] == 'unkick') then
- if (perm == 1) then
- local player
- if (arg[2]) then
- player = arg[2]:lower():gsub('%a', string.upper, 1)
- if (data.player.list[player]) then
- data.player.list[player].ban = false
- data.player.list[player].banTime = 0
- data.player.list[player].banReason = ''
- banWarning(player)
- end
- end
- end
- elseif (arg[1] == 'unrank') then
- if (perm == 1) then
- local player
- if (arg[2]) then
- player = arg[2]:lower():gsub('%a', string.upper, 1)
- if (data.player.list[player]) then
- data.player.list[player].rounds = 1
- data.player.list[player].wins = 0
- end
- end
- end
- elseif (data.isTribeHouse and arg[1] == 'powerup') then
- if (perm == 1) then
- if (arg[2]) then
- setPowerup(arg[2])
- else
- setPowerup()
- end
- end
- end
- end
- function eventKeyboard(name, key, down, x, y)
- if (key == 32) then
- if (not tfm.get.room.playerList[name].isDead) then
- local distx = math.abs(x - data.powerup.x)
- local disty = math.abs(y - data.powerup.y)
- if (distx <= 35 and disty <= 35 and data.powerup.currentType ~= '') then
- data.powerup.list[data.powerup.currentType](name, x, y)
- table.foreach(tfm.get.room.playerList, function(k)
- tfm.exec.chatMessage(string.format(translate(k, 'caughtPowerup'), name, data.powerup.currentType), k)
- end)
- data.powerup.currentType = ''
- ui.removeTextArea(201, nil)
- if (data.img ~= '') then
- tfm.exec.removeImage(data.img)
- data.img = ''
- end
- end
- end
- elseif (key == 72) then
- if (not data.player.list[name].openhelp) then
- showHelp(name)
- else
- eventTextAreaCallback(nil, name, 'closehelp')
- end
- elseif (key == 76) then
- if (not data.player.list[name].openrank) then
- showRanking(name)
- else
- eventTextAreaCallback(nil, name, 'closerank')
- end
- end
- end
- function eventTextAreaCallback(id, name, link)
- if (link == 'openhelp') then
- showHelp(name)
- elseif (link == 'opencredits') then
- showCredits(name)
- elseif (link == 'openpowerups') then
- showPowerups(name)
- elseif link == 'closehelp' then
- data.player.list[name].openhelp = false
- for id = 0, 15 do
- ui.removeTextArea(id,name)
- end
- elseif (link == 'closerank') then
- data.player.list[name].openrank = false
- for id = 50, 71 do
- ui.removeTextArea(id, name)
- end
- elseif (link == 'mapsLink') then
- tfm.exec.chatMessage('<vp>https://atelier801.com/topic?f=819406&t=924082</vp>', name)
- end
- end
- function eventNewGame()
- data.powerup.traps = {}
- for _, id in next, {201, 100, 101, 102} do
- ui.removeTextArea(id, nil)
- end
- local xml = (tfm.get.room.xmlMapInfo and tfm.get.room.xmlMapInfo.xml)
- if (xml) then
- local mapProp = string.match(xml, "<C><P(.-)/>")
- local w, h = string.match(mapProp, 'L="(%d+)"'), string.match(mapProp, 'H="(%d+)"')
- data.map.width, data.map.height = (w and tonumber(w) or 800), (h and tonumber(h) or 400)
- end
- randomPlayer(1)
- local p = 0
- for k, v in next, tfm.get.room.playerList do
- p = (p + 1)
- if (data.player.list[k].ban) then
- tfm.exec.killPlayer(k)
- end
- end
- if (p >= 6) then
- for k, v in next, data.player.list do
- if (tfm.get.room.playerList[k]) then
- v.rounds = (v.rounds + 1)
- end
- end
- end
- tfm.exec.setGameTime(240)
- end
- function eventLoop(t, r)
- local t, r = (t/1000), (r/1000)
- data.currentTime = r
- for k, v in next, data.block.increaseTick do
- if (t >= k and t <= (k + .5)) then
- local w, h = (data.block.list[1].width + v), (data.block.list[1].height + v)
- data.block.list[1].width, data.block.list[1].height = w, h
- table.foreach(tfm.get.room.playerList, function(k)
- tfm.exec.chatMessage(translate(k, 'block'), k)
- end)
- end
- end
- if (#data.powerup.traps > 0) then
- for i = #data.powerup.traps, 1, -1 do
- local id = data.powerup.traps[i][1]
- local time = data.powerup.traps[i][2]
- if (time < os.time() - 10000) then
- tfm.exec.removeObject(id)
- table.remove(data.powerup.traps, i)
- end
- end
- end
- local target = targetSelect()
- if (#target >= 1) then
- update()
- end
- for k, v in next,tfm.get.room.playerList do
- if (data.player.list[k].ban) then
- banWarning(k)
- end
- for i = 1, #target do
- local blockx, blocky = data.block.list[i].x, data.block.list[i].y
- local blockw = data.block.list[i].width*.5
- if (not v.isDead and distance(v.x, v.y, blockx, blocky, blockw+10)) then
- if (not data.player.list[k].immortality[1]) then
- tfm.exec.killPlayer(k)
- elseif (data.player.list[k].immortality[1] and data.player.list[k].immortality[2] <= (os.time() - 10000)) then
- data.player.list[k].immortality[1] = false
- tfm.exec.killPlayer(k)
- end
- end
- end
- end
- for k, v in next, data.player.list do
- if (v.ban) then
- v.banTime = (v.banTime - .5)
- end
- end
- if (r < 1) then
- newMap()
- end
- end
- function eventPlayerWon(name)
- tfm.exec.setGameTime(5, false)
- winner = name
- time2 = 666
- for k, v in next, tfm.get.room.playerList do
- ui.addTextArea(100, string.format("<p align='center'><font size='35' color='#00000'>%s %s!", name, translate(k, 'win')), k, 5, 170, 800, nil, nil, nil, 0, true)
- ui.addTextArea(101, string.format("<p align='center'><font size='35'>%s %s!", name, translate(k, 'win')), k, 8, 170, 800, nil, nil, nil, 0, true)
- end
- local p = 0
- for k, v in next, tfm.get.room.playerList do
- p = (p + 1)
- end
- if (p >= 6) then
- data.player.list[name].wins = (data.player.list[name].wins + 1)
- end
- end
- function eventPlayerDied(name)
- local players = {}
- local a = 0
- for k, v in next, tfm.get.room.playerList do
- if (not v.isDead) then
- a = (a + 1)
- players[a] = k
- end
- end
- if (a == 0) then
- table.foreach(tfm.get.room.playerList, function(k)
- ui.addTextArea(100, string.format("<p align='center'><font size='35' color='#00000'>%s!", translate(k, 'noWinner')), k, 5, 170, 800, nil, nil, nil, 0, true)
- ui.addTextArea(101, string.format("<p align='center'><font size='35'>%s!", translate(k, 'noWinner')), k, 8, 170, 800, nil, nil, nil, 0, true)
- end)
- tfm.exec.setGameTime(5, false)
- elseif (a == 1) then
- tfm.exec.giveCheese(players[1])
- tfm.exec.playerVictory(players[1])
- elseif (a == 20 or a == 15 or a == 10 or a == 5 or a == 2) then
- setPowerup()
- end
- if (data.player.list[name].target ~= 0) then
- local target = data.player.list[name].target
- data.player.list[name].target = 0
- if (a > 1) then
- randomPlayer(target)
- end
- end
- end
- function eventPlayerLeft(name)
- eventPlayerDied(name)
- data.player.list[name].openhelp, data.player.list[name].openrank = false, false
- end
- tfm.exec.setRoomMaxPlayers(25)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement