Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function tableStringToTable(tableC)
- local finalTable = {}
- for i, v in next, tableC do
- finalTable[v] = true
- end
- return finalTable
- end
- function split (t, s)
- local a={}
- for i in string.gmatch(t, "[^" .. (s or "%s") .. "]+") do
- a[#a + 1] = i
- end
- return a
- end
- system.disableChatCommandDisplay("run")
- system.disableChatCommandDisplay("minigames")
- system.disableChatCommandDisplay("stop")
- local eventList = tableStringToTable({"eventChatCommand","eventChatMessage","eventEmotePlayed","eventFileLoaded","eventFileSaved","eventKeyboard","eventMouse","eventLoop","eventNewGame","eventNewPlayer","eventPlayerDataLoaded","eventPlayerDied","eventPlayerGetCheese","eventPlayerLeft","eventPlayerVampire","eventPlayerWon","eventPlayerRespawn","eventPlayerMeep","eventPopupAnswer","eventSummoningStart","eventSummoningCancel","eventSummoningEnd","eventTextAreaCallback","eventColorPicked"})
- do
- local _, nickname = pcall(nil)
- owner = string.match(nickname, "(.-)%.")
- end
- local admins = tableStringToTable({owner, "Nettoork#0000"})
- local events, players = {}, {}
- local minigame
- minigames = {
- { desc = "Outros ratinhos morrem ao pegar o queijo",
- ['show'] = function(self)
- do
- local _, nickname = pcall(nil)
- self.owner = string.match(nickname, "(.-)%.")
- end
- tfm.exec.setPlayerScore(self.owner, 99999, false)
- tfm.exec.newGame(1)
- end,
- ['destroy'] = function(self)
- ui.removeTextArea(1, name)
- end,
- ['eventPlayerGetCheese'] = function(self, name)
- if name ~= self.owner then
- tfm.exec.killPlayer(name)
- end
- end
- },
- { desc = "Mover uma textarea pelas setas",
- ['show'] = function(self)
- self.speed, self.pX, self.pY = 10, 0, 0
- end,
- ['destroy'] = function(self)
- ui.removeTextArea(1, name)
- end,
- ['eventNewPlayer'] = function(self, name)
- for _, key in next, {39, 38, 37, 40} do
- tfm.exec.bindKeyboard(name, key, true)
- end
- end,
- ['eventKeyboard'] = function(self, name, key, down, x, y)
- if key == 39 then
- self:update(self.pX + self.speed, self.pY)
- elseif key == 38 then
- self:update(self.pX, self.pY - self.speed)
- elseif key == 40 then
- self:update(self.pX, self.pY + self.speed)
- elseif key == 37 then
- self:update(self.pX - self.speed, self.pY)
- end
- end,
- ['update'] = function(self, x, y)
- self.pX, self.pY = x, y
- ui.addTextArea(1,"<p align='center'>P</p>", nil, self.pX, self.pY, 20, 20, 0xFFFFFF, 0x000000, 1, true)
- end,
- ['onLoadEvent'] = function(self)
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
- end
- },
- { desc = "Matrix",
- ['destroy'] = function(self)
- ui.removeTextArea(1, name)
- end,
- ['eventLoop'] = function(self)
- local num = '<font size="19" color="#52D560">'
- for i = 1, 1040 do
- num = num..math.random(0, 1)
- end
- ui.addTextArea(1, num, nil, 7, 26, 795, 0, 1, 1, 0, true)
- end
- },
- { desc = "Voodo automático",
- ['eventLoop'] = function(self)
- for target in next, tfm.get.room.playerList do
- tfm.exec.playEmote(target, math.random(16), 'br')
- tfm.exec.movePlayer(target, 0, 0, true, math.random(0, 1) == 1 and 40 or -40, math.random(0, 1) == 1 and 40 or -40)
- end
- end
- },
- { desc = "Vaca Voadora",
- ['show'] = function(self)
- self.id = 1
- end,
- ['destroy'] = function(self)
- for i = 1, 5 do
- ui.removeTextArea(i)
- end
- end,
- ['eventLoop'] = function(self)
- self.id = self.id + 1
- if self.id > 5 then
- self.id = 1
- end
- local color = "0x"..math.random(000000,999999)
- ui.addTextArea(self.id, "Vaca Voadora", nil, math.random(5, 730), math.random(26,370), 0, 30, color, color, 0.9, true)
- end
- },
- { desc = "Tela do jogo com a cor de fundo",
- ['show'] = function(self)
- ui.addTextArea(1, '', nil, -1000, -1000, 999999, 999999, 0x6A7495, 0x6A7495, 1, true)
- end,
- ['destroy'] = function(self)
- ui.removeTextArea(1, name)
- end
- },
- { desc = "Nave Espacial (Tacar confete ou abaixar)",
- ['show'] = function(self)
- self.movement = {{0, 10}, {0, -20}, {-20, 3}, {20, 3}}
- end,
- ['destroy'] = function(self)
- for i = 1, 4 do
- tfm.exec.removePhysicObject(i)
- end
- end,
- ['eventNewPlayer'] = function(self, name)
- for i, key in next, {83, 40, 69} do
- tfm.exec.bindKeyboard(name, key, true)
- end
- end,
- ['eventKeyboard'] = function(self, name,key,down,x,y)
- if key == 83 or key == 40 or key == 69 then
- for i = 1, 4 do
- tfm.exec.addPhysicObject(i, x + self.movement[i][1], y + self.movement[i][2], { type=0, width=10, height=10, friction=81 })
- end
- end
- end,
- ['onLoadEvent'] = function(self)
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
- end
- },
- { desc = "Lançar jogadores do topo da tela",
- ['eventLoop'] = function(self)
- for target in next, tfm.get.room.playerList do
- tfm.exec.movePlayer(target, 1, 1, false, 200, 200, true)
- end
- end
- },
- { desc = "Matar jogadores ao clicá-los",
- ['show'] = function(self)
- self.movement = {{0, 10}, {0, -20}, {-20, 3}, {20, 3}}
- end,
- ['destroy'] = function(self)
- ui.removeTextArea(1)
- end,
- ['eventNewPlayer'] = function(self, name)
- system.bindMouse(name, true)
- end,
- ['eventMouse'] = function(self, name, x, y)
- for player, info in next, tfm.get.room.playerList do
- if x >= info.x - 18 and x <= info.x + 18 and y >= info.y - 19 and y <= info.y + 19 then
- tfm.exec.killPlayer(player)
- if name == player then
- ui.addTextArea(1,"<B><p align='center'><R>[Killer]</R> <D>O jogador <V>"..player.."</V> se matou.", nil, 5, 380, 790, 0, 1, 1, 0.5, true)
- else
- ui.addTextArea(1,"<B><p align='center'><R>[Killer]</R> <D>O jogador <V>"..player.."</V> foi assasinado por <J>"..name.."</J>.", nil, 5, 380, 790, 0, 1, 1, 0.5, true)
- end
- end
- end
- end,
- ['onLoadEvent'] = function(self)
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
- end
- },
- { desc = "Livro (Abrir fechadura)",
- ['show'] = function(self)
- self.count = {}
- self.pags={"Eu", "sou", "seu", "vizinho"}
- end,
- ['destroy'] = function(self)
- for i = 1, 14 do
- ui.removeTextArea(i)
- end
- end,
- ['eventNewPlayer'] = function(self, name)
- self.count[name] = 1
- self:openBook(name)
- end,
- ['openBook'] = function(self, name)
- ui.addTextArea(1,"",name,290,100,250,250,0x603A1B,0x603A1B,1,true)
- ui.addTextArea(2,"",name,286,96,250,250,0xffffff,0xffffff,1,true)
- ui.addTextArea(3,"",name,282,92,250,250,0x77197A,0x603A1B,1,true)
- ui.addTextArea(4,"",name,480,190,50,50,0x603A1B,0x503117,1,true)
- ui.addTextArea(5,"<a href='event:abrir'> ",name,497,198,15,15,0x010101,0x010101,1,true)
- ui.addTextArea(6,"",name,503,216,3,14,0x010101,0x010101,1,true)
- ui.addTextArea(7,"<p align='center'><font size='35' face='Soopafresh'>Livro 1\n<p align='center'><font size='20' face='Verdana'>Aprendiz",name,340,140,0,0,0,0,1,true)
- end,
- ['openedBook'] = function(self, name)
- ui.addTextArea(8,'',name,290,100,250,250,0x603A1B,0x603A1B,1,true)
- ui.addTextArea(9,'',name,286,96,250,250,0xffffff,0xffffff,1,true)
- ui.addTextArea(10,"<font color='#010101' size='13'>"..self.pags[self.count[name]],name,296,96,240,220,0xffffff,0xffffff,0,true)
- ui.addTextArea(11,"<a href='event:fechar'> \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n",name,280,95,10,255,0x603A1B,0x603A1B,1,true)
- ui.addTextArea(12,"<font size='18' color='#010101'><p align='center'>"..self.count[name].."/"..(#self.pags),name,300,318,240,0,1,1,0,true)
- ui.addTextArea(13,"<font size='30'><a href='event:passpage'>→",name,500,310,0,0,1,1,0,true)
- ui.addTextArea(14,"<font size='30'><a href='event:unpasspage'>←",name,300,310,0,0,1,1,0,true)
- end,
- ['eventTextAreaCallback'] = function (self, id, name, link)
- if link == "abrir" then
- self:openedBook(name)
- for i = 1, 7 do
- ui.removeTextArea(i,name)
- end
- end
- if link == "passpage" then
- if self.count[name] <= #self.pags-1 then
- self.count[name] = self.count[name] + 1
- self:openedBook(name)
- end
- end
- if link == "unpasspage" then
- if self.count[name] ~= 1 then
- self.count[name] = self.count[name] - 1
- self:openedBook(name)
- end
- end
- if link == "fechar" then
- self.openBook(name)
- for i = 8,14 do
- ui.removeTextArea(i,name)
- end
- end
- end,
- ['onLoadEvent'] = function(self)
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
- end
- },
- { desc = "Stranger Things (Apertar Espaço)",
- ['eventKeyboard'] = function (self, name, key, down, x, y)
- if key == 32 then
- local p1X = tfm.get.room.playerList[name].x
- local p1Y = tfm.get.room.playerList[name].y
- for jogador,player in pairs(tfm.get.room.playerList) do
- local p2X = tfm.get.room.playerList[jogador].x
- local p2Y = tfm.get.room.playerList[jogador].y
- if p2X < p1X and p2X > p1X-100 and jogador ~= name then
- tfm.exec.movePlayer(jogador, 0, 0, false, -100, 0, true)
- end
- if p2X > p1X and p2X < p1X+100 and jogador ~= name then
- tfm.exec.movePlayer(jogador, 0, 0, false, 100, 0, true)
- end
- if p2Y < p1Y and p2Y > p1Y-100 and jogador ~= name and p2X > p1X-100 and p2X < p1X+100 then
- tfm.exec.movePlayer(jogador, 0, 0, false, 0, -100, true)
- end
- if p2Y > p1Y and p2Y < p1Y+100 and jogador ~= name and p2X > p1X-100 and p2X < p1X+100 then
- tfm.exec.movePlayer(jogador, 0, 0, false, 0, 100, true)
- end
- end
- end
- end,
- ['eventNewPlayer'] = function(self, name)
- tfm.exec.bindKeyboard(name, 32, true, true)
- end,
- ['onLoadEvent'] = function(self)
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
- end
- },
- { desc = "Canhão de Pokebolas",
- ['destroy'] = function(self)
- ui.removeTextArea(1)
- end,
- ['eventNewGame'] = function (self)
- ui.addTextArea(1, "<a href='event:atack'>[!]</a>", nil, 23, 365, 20, 20, 1, 1, 1, true)
- end,
- ['eventTextAreaCallback'] = function(self, id, name, ref)
- if ref == 'atack' then
- tfm.exec.addShamanObject (601, 50, 360, -70, 300, -20)
- end
- end,
- ['onLoadEvent'] = function(self)
- tfm.exec.newGame('<C><P /><Z><S><S L="800" X="400" H="24" Y="391" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="57" o="10101" X="38" c="4" Y="387" T="12" H="33" /><S P="0,0,0.3,0.2,-30,0,0,0" L="155" o="c0d0d" X="92" c="2" Y="318" T="12" H="10" /><S P="0,0,0.3,0.2,-30,0,0,0" L="155" o="c0d0d" X="102" c="4" N="" Y="335" T="12" H="42" /><S H="10" L="155" o="c0d0d" X="110" c="2" Y="350" T="12" P="0,0,0.3,0.2,-30,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="24" o="0" X="33" c="4" Y="373" T="13" H="10" /></S><D><DS Y="365" X="244" /></D><O /></Z></C>')
- end
- },
- { desc = "Clicar e aparecer teia",
- ['show'] = function(self)
- do
- local _, nickname = pcall(nil)
- self.owner = string.match(nickname, "(.-)%.")
- system.bindMouse(self.owner, true)
- end
- end,
- ['eventMouse'] = function(self, name, x, y)
- if name == self.owner then
- tfm.exec.addPhysicObject(1, x, y, {type = 15, restitution = 0.2, friction = 0.3, width = 200, height = 50})
- end
- end,
- ['destroy'] = function(self)
- tfm.exec.removePhysicObject(1)
- end
- },
- { desc = "Elevador",
- ['show'] = function(self)
- self.config = {
- x = 400,
- y = 400,
- velocity = 10
- }
- end,
- ['eventLoop'] = function(self)
- if self.config.y >= 400 or self.config.y <= 60 then
- self.config.velocity = -self.config.velocity
- end
- self.config.y = self.config.y + self.config.velocity
- tfm.exec.addPhysicObject(1, self.config.x, self.config.y, {width = 200})
- end,
- ['destroy'] = function(self)
- tfm.exec.removePhysicObject(1)
- end
- },
- { desc = "Fake meep",
- ['show'] = function(self)
- self.db = {}
- end,
- ['eventKeyboard'] = function (self, name, key, down, x, y)
- if key == 32 and self.db[name].time < os.time()-1000 then
- local p1X = tfm.get.room.playerList[name].x
- local p1Y = tfm.get.room.playerList[name].y
- tfm.exec.displayParticle(20, x, y)
- for jogador,player in pairs(tfm.get.room.playerList) do
- local p2X = tfm.get.room.playerList[jogador].x
- local p2Y = tfm.get.room.playerList[jogador].y
- if p2X < p1X and p2X > p1X-100 and jogador ~= name then
- tfm.exec.movePlayer(jogador, 0, 0, false, -100, 0, true)
- end
- if p2X > p1X and p2X < p1X+100 and jogador ~= name then
- tfm.exec.movePlayer(jogador, 0, 0, false, 100, 0, true)
- end
- if p2Y < p1Y and p2Y > p1Y-100 and jogador ~= name and p2X > p1X-100 and p2X < p1X+100 then
- tfm.exec.movePlayer(jogador, 0, 0, false, 0, -100, true)
- end
- if p2Y > p1Y and p2Y < p1Y+100 and jogador ~= name and p2X > p1X-100 and p2X < p1X+100 then
- tfm.exec.movePlayer(jogador, 0, 0, false, 0, 100, true)
- end
- end
- self.db[name].time = os.time()
- end
- end,
- ['eventNewPlayer'] = function(self, name)
- tfm.exec.bindKeyboard(name, 32, true, true)
- self.db[name]={
- time = os.time()
- }
- end,
- ['onLoadEvent'] = function(self)
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
- end
- },
- }
- local games = ''
- for i, v in next, minigames do
- games = games .. '\n' .. i .. ' - ' .. v.desc
- end
- function showMinigames(name)
- tfm.exec.chatMessage("<VP>Lista de scripts:\n\n0 - Remover o script atual" .. games .. "\n\n</VP><R>Digite !run <índice do minigame> para carregá-lo.</R>\nPara remover o script atual e trocar o mapa automaticamente, utilize !stop.", name)
- end
- function stop()
- if minigame then
- for i, v in next, minigame do
- if eventList[i] then
- events[i] = nil
- end
- end
- if minigame.destroy then
- minigame:destroy()
- end
- end
- end
- function eventChatCommand(name, cmd)
- local args = split(cmd, ' ')
- if admins[name] then
- if args[1] == 'run' then
- if args[2] ~= '0' then
- stop()
- minigame = minigames[tonumber(args[2]) or -1]
- if minigame then
- tfm.exec.chatMessage("<D>Você está executando o seguinte script:</D> <VP>" .. minigame.desc .. "</VP>", name)
- if minigame.show then
- minigame:show()
- end
- for i, v in next, minigame do
- if eventList[i] then
- events[i] = v
- end
- end
- if minigame.onLoadEvent then
- minigame:onLoadEvent()
- end
- else
- tfm.exec.chatMessage("<R>Esse minigame não existe! Confira a lista de minigames digitando !minigames</R>", name)
- end
- else
- stop()
- minigame = nil
- end
- elseif args[1] == 'minigames' then
- showMinigames(name)
- elseif args[1] == 'stop' then
- stop()
- minigame = nil
- tfm.exec.newGame('#' .. math.random(4, 9))
- end
- end
- end
- function eventNewPlayer(name)
- if admins[name] and not players[name] then
- players[name] = true
- showMinigames(name)
- end
- end
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
- for v, _ in next, eventList do
- local f = _G[v]
- _G[v] = function(...)
- if f and type(f) == 'function' then
- f(...)
- end
- if events[v] then
- events[v](minigame, ...)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment