Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ui.addPopup(0, 0, "RatoBird V1 \nVoe com E ou seta para baixo\nTente voar com o queijo e chegar na toca\n By Xlyjc\n", nil, 0, 162, 788, true)
- ui.addTextArea(0, "Enjoy by Xlyjc", nil, 690, 370, 100, 20, 0x000000, 0xff00dd, 1, true)
- function eventNewPlayer(name)
- for i,key in ipairs({83,40,69}) do
- tfm.exec.bindKeyboard(name,key,true,true)
- end
- end
- function eventKeyboard(name,key,down,x,y)
- if key==83 or key==40 or key==69 then
- tfm.exec.movePlayer(name,0,0,true,0,-50,true)
- end
- end
- for name,player in pairs(tfm.get.room.playerList) do
- eventNewPlayer(name)
- end
- print("Voe E ou seta para baixo by Xlyjc!")
- --[[
- COMO INICIAR?
- Copie todo o Script e siga as instruções que vão aparecer no chat #lua
- COMANDOS:
- !game Jogador1 Jogador2 - INICIA NOVO JOGO
- !score Jogador Ponto - MUDA A PONTUAÇAO DO JOGADOR
- !pause Jogador - PAUSA O TEMPO, VOCÊ PODE MUDAR O TEMPO MAXIMO EM _MAIN.config.pauseDelay, PARA DESPAUSAR UTILIZE O COMANDO NOVAMENTE
- !chola - RSRSRSRSRSRSRSRS
- !bb
- BOM JOGO!
- ]]--
- _MAIN = {
- admins = {Xlyjc = true},
- participants = {},
- command = "",
- config = {
- win = 2,
- difference = 0,
- lowerTime = 10,
- paused = false,
- canShowScore = false,
- pauseDelay = 120,
- mapid = 1,
- lastfirst = "",
- invertedGame = "",
- },
- maps = {"@7340839","@7340893"},
- }
- _MESSAGES = {
- newGame = "<p align=\"center\"><font size=\"46\" color=\"#FFF10F\" face=\"Crazy Krabs\">Nova Partida!</font><BR><font size=\"18\" color=\"#F700FF\" face=\"Crazy Krabs\">%s!</font></p>",
- score = "<p align=\"center\"><font size=\"16\" color=\"#FFFFFF\" face=\"Verdana\">| %s</font></p>",
- paused = "<p align=\"center\"><font size=\"14\" color=\"#FFFFFF\">Jogo pausado para %s</font></p>",
- unpaused = "<p align=\"center\"><font size=\"14\" color=\"#FFFFFF\">Jogo retomado para %s</font></p>",
- pausedInfo = "<p align=\"left\"><font size=\"12\" color=\"#FFFFFF\">%s</font></p>",
- timeUp = "<p align=\"center\"><font size=\"46\" color=\"#FFFFFF\">Tempo esgotado para %s!</font></p>",
- timeCanceled = "<p align=\"center\"><font size=\"46\" color=\"#FFFFFF\">TEMPO RETOMADO!</font><BR><font size=\"14\" color=\"#FFFFFF\" face=\"Verdana\">Reiniciando jogo no próximo mapa!</font></p>",
- first = "<p align=\"center\"><font size=\"46\" color=\"#0100FF\" face=\"Crazy Krabs\">%s GG!</font></p>",
- newScore = "<p align=\"left\"><font size=\"14\" color=\"#FFFFFF\">Pontuação de %s mudada para %s</font></p>",
- gameWon = "<p align=\"center\"><font size=\"36\" color=\"#FFF10F\" face=\"Crazy Krabs\">Acabou! %s ganhou!</font><br><font size=\"14\" color=\"#FFF10F\" face=\"Crazy Krabs\">GG %s! %s</font></p>",
- }
- _ROUND = {
- place = 0,
- counter = 0,
- lastfirst = {}
- }
- _UI = {
- windows = {}
- }
- function string.split(rawString, separator)
- splittedString = {}
- for str in string.gmatch(rawString, "[^"..separator.."]+") do
- table.insert(splittedString, str)
- end
- return splittedString
- end
- function string.title(rawString)
- allWords = string.split(rawString, " ")
- for index, word in pairs(allWords) do
- allWords[index] = string.gsub(string.lower(word), "%a", string.upper, 1)
- end
- return table.concat(allWords, " ")
- end
- function string.startswith(rawString, toCompare)
- return (string.sub(rawString, 0, string.len(toCompare)) == toCompare)
- end
- function string.getsubstring(rawString, toSub)
- return (string.sub(rawString, string.len(toSub)))
- end
- function _UI.updateScore()
- scoreString = ""
- if not _MAIN.config.paused then
- for player, data in pairs(_MAIN.participants) do
- scoreString = string.format("%s jogador: <font color=\"#0010FF\">%s:</font> <font color=\"#0010FF\">%s</font> /", scoreString, player, data.pontuation)
- end
- else
- scoreString = "<font color=\"#FFFFFF\">PAUSADO</font> /"
- end
- _UI.createWindow(2, string.format(_MESSAGES.score, scoreString), nil, 0, 20, 800, nil, true, os.time())
- end
- function _UI.createWindow(id, text, affected, positionX, positionY, width, height, fixed, lifeTime)
- blackText = string.gsub(text, "color=\"[0-9A-Za-z#]+\"", "color=\"#000000\"")
- ui.addTextArea(id*10, blackText, affected, positionX-1, positionY, width, height, 0, 0, 0, fixed)
- ui.addTextArea(id*100, blackText, affected, positionX+1, positionY, width, height, 0, 0, 0, fixed)
- ui.addTextArea(id*1000, blackText, affected, positionX, positionY-1, width, height, 0, 0, 0, fixed)
- ui.addTextArea(id*10000, blackText, affected, positionX, positionY+1, width, height, 0, 0, 0, fixed)
- ui.addTextArea(id*100000, text, affected, positionX, positionY, width, height, 0, 0, 0, fixed)
- _UI.windows[id] = {spawn = os.time(), id = id, life = lifeTime*1000}
- end
- function table.shuffle(rawTable)
- local iterations = #rawTable
- local j
- for i = iterations, 2, -1 do
- j = math.random(i)
- rawTable[i], rawTable[j] = rawTable[j], rawTable[i]
- end
- return rawTable
- end
- function _MAIN.checkPauses()
- pauses = 0
- for player, data in pairs(_MAIN.participants) do
- if data.paused then
- pauses = pauses+1
- end
- end
- return pauses
- end
- function _MAIN.chooseNewGame()
- _MAIN.config.mapid = _MAIN.config.mapid+1
- if _MAIN.config.mapid > #_MAIN.maps then
- _MAIN.config.mapid = 1
- end
- tfm.exec.newGame(_MAIN.maps[_MAIN.config.mapid])
- end
- function _MAIN.getScoreDifference(player)
- local diff = 0
- local points = _MAIN.participants[player].pontuation
- for name, data in pairs(_MAIN.participants) do
- if name ~= player then
- diff = diff+data.pontuation
- end
- end
- return points-diff
- end
- function eventLoop(timeElapsed, timeRemain)
- timeRemain = math.ceil(timeRemain/1000)
- if _MAIN.config.started then
- if timeRemain <= 1 then
- _MAIN.chooseNewGame()
- end
- end
- for index, window in pairs(_UI.windows) do
- if window.spawn < os.time()-window.life then
- for _, multiplier in pairs({10, 100, 1000, 10000, 100000}) do
- ui.removeTextArea(window.id*multiplier)
- end
- window = nil
- end
- if window and window.id and window.id == 8 then
- for i = 80, 0, -1 do
- ids = {31, 32}--{0, 1, 2, 9, 11, 13}
- tfm.exec.displayParticle(ids[math.random(#ids)], math.random(200, 600), math.random(180, 240), math.random(-0.11, 0.11), math.random(-0.11, 0.11), math.random(-0.11, 0.11), math.random(-0.11, 0.11))
- end
- end
- end
- if _MAIN.config.paused then
- text = ""
- for player, data in pairs(_MAIN.participants) do
- if data.paused then
- decorredTime = math.ceil((os.time()-data.paused)/1000)--(_MAIN.config.pauseDelay*1000)
- timeMin = (_MAIN.config.pauseDelay)-decorredTime
- timeFormat = string.format("%.2d:%.2d:%.2d", timeMin/(60*60), timeMin/60%60, timeMin%60)
- text = text..player..": "..timeFormat.."\n"
- if timeMin < 0 then
- data.paused = false
- _UI.createWindow(3, string.format(_MESSAGES.timeUp, player), nil, 0, 160, 800, nil, true, 5)
- _UI.updateScore()
- end
- end
- end
- _UI.createWindow(4, string.format(_MESSAGES.pausedInfo, text), nil, 0, 140, 800, nil, true, 1)
- if _MAIN.checkPauses() == 0 then
- _MAIN.config.paused = false
- _UI.createWindow(3, _MESSAGES.timeCanceled, nil, 0, 160, 800, nil, true, 3)
- tfm.exec.setGameTime(3)
- end
- end
- end
- function eventPlayerWon(player, timeElapsed)
- if _MAIN.participants[player] then
- if _MAIN.config.lastfirst == player then
- _MAIN.participants[player].firstsLine = _MAIN.participants[player].firstsLine+1
- else
- if _MAIN.participants[_MAIN.config.lastfirst] then
- if _MAIN.participants[_MAIN.config.lastfirst].firstsLine >= _MAIN.config.win/2 then
- _MAIN.config.invertedGame = player
- end
- _MAIN.participants[_MAIN.config.lastfirst].firstsLine = 0
- end
- _MAIN.config.lastfirst = player
- end
- if not _MAIN.config.paused then
- _ROUND.place = _ROUND.place+1
- if _ROUND.place == 1 then
- tfm.exec.setGameTime(5)
- _MAIN.participants[player].pontuation = _MAIN.participants[player].pontuation+1
- local difference = _MAIN.getScoreDifference(player)
- _UI.createWindow(3, string.format(_MESSAGES.first, player), nil, 0, 180, 800, nil, true, 5)
- if _MAIN.participants[player].pontuation >= _MAIN.config.win and _MAIN.getScoreDifference(player) >= _MAIN.config.difference then
- specialMessage = string.format("Voador %s! ", _MAIN.participants[_MAIN.config.lastfirst].firstsLine)
- if _MAIN.getScoreDifference(player) == 0 then
- specialMessage = string.format("%s Muito Bom!", specialMessage)
- elseif _MAIN.getScoreDifference(player) == 1 then
- specialMessage = string.format("%s Ratinho voador", specialMessage)
- end
- if _MAIN.config.invertedGame == player then
- specialMessage = string.format("%s GG MAN!", specialMessage)
- end
- print(difference)
- _UI.createWindow(3, string.format(_MESSAGES.gameWon, player, difference, specialMessage), nil, 0, 160, 800, nil, true, 20)
- _MAIN.participants = {}
- end
- end
- end
- end
- _UI.updateScore()
- end
- function eventNewGame()
- _ROUND.place = 0
- _UI.updateScore()
- if _MAIN.config.started then
- tfm.exec.setGameTime(60)
- end
- end
- function eventChatCommand(player, command)
- if command == _MAIN.command then
- _MAIN.admins[player] = true
- _MAIN.command = tostring(math.random())
- _UI.createWindow(4, string.format("<font color=\"#FFFFFF\">%s script pronto para uso", player), nil, 10, 380, 800, nil, true, 5)
- end
- if _MAIN.admins[player] then
- if string.startswith(command, "game") then
- toPlay = string.split(string.title(string.getsubstring(command, "game ")), " ")
- _MAIN.participants = {}
- for index, player in pairs(toPlay) do
- if tfm.get.room.playerList[player] then
- _MAIN.participants[player] = {pontuation = 0, paused = false, firstsLine = 0}
- toPlay[index] = string.format("<font color=\"#30BA76\">%s</font>", player)
- else
- toPlay[index] = string.format("<font color=\"#FFFFFF\">%s</font>", player)
- end
- if toPlay[index] then
- if player == "Gecs" then
- toPlay[index] = "<font color=\"#30BA76\">Gecs <font size=\"9\">nooba</font></font>"
- end
- end
- end
- _MAIN.config.canShowScore = true
- _MAIN.config.started = true
- _UI.updateScore()
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.setGameTime(3)
- _MAIN.maps = table.shuffle(_MAIN.maps)
- _UI.createWindow(1, string.format(_MESSAGES.newGame, table.concat(toPlay, " vs ")), nil, 0, 160, 800, nil, true, 5)
- elseif string.startswith(command, "score") then
- toScore = string.split(string.title(string.getsubstring(command, "score ")), " ")
- if _MAIN.participants[toScore[1]] then
- if tonumber(toScore[2]) then
- _MAIN.participants[toScore[1]].pontuation = tonumber(toScore[2])
- _UI.createWindow(4, string.format(_MESSAGES.newScore, toScore[1], toScore[2]), nil, 10, 380, 800, nil, true, 5)
- end
- end
- _UI.updateScore()
- elseif string.startswith(command, "chola") then
- _UI.createWindow(8, "<p align=\"center\"><font color=\"#FFFFFF\" size=\"40\">CHOLA MAIS", nil, 0, 180, 800, nil, true, 5)
- elseif string.startswith(command, "bb") then
- _UI.createWindow(8, "<p align=\"center\"><font color=\"#F100FF\" size=\"40\">BB!", nil, 0, 180, 800, nil, true, 5)
- elseif string.startswith(command, "brabo") then
- _UI.createWindow(8, "<p align=\"center\"><font color=\"#F100FF\" size=\"40\">EU TO BRABO", nil, 0, 180, 800, nil, true, 5)
- elseif string.startswith(command, "gjuo") then
- _UI.createWindow(8, "<p align=\"center\"><font color=\"#FF0B00\" size=\"40\">Modo Flash Ativado = Gjuo kkk", nil, 0, 180, 800, nil, true, 5)
- elseif string.startswith(command, "maluco") then
- _UI.createWindow(8, "<p align=\"center\"><font color=\"#FFFFFF\" size=\"40\">MALUCO E BRABO", nil, 0, 180, 800, nil, true, 5)
- elseif string.startswith(command, "pause") then
- toPause = string.title(string.getsubstring(command, "pause "))
- if _MAIN.participants[toPause] then
- if not _MAIN.participants[toPause].paused then
- _MAIN.config.paused = true
- _MAIN.participants[toPause].paused = os.time()
- _UI.createWindow(6, string.format(_MESSAGES.paused, toPause), nil, 0, 380, 800, nil, true, 3)
- else
- _MAIN.participants[toPause].paused = false
- _UI.createWindow(6, string.format(_MESSAGES.unpaused, toPause), nil, 0, 380, 800, nil, true, 3)
- end
- end
- _UI.updateScore()
- end
- end
- end
- _MAIN.command = string.format("%x", math.random(0x000000, 0xFFFFFFF)..math.random(0x000000, 0xFFFFFFF))
- _UI.createWindow(6, "<p align=\"center\"><font size=\"36\" color=\"#0100FF\" face=\"Sweetpaint\">RatoBird !</font><br><font size=\"18\" color=\"#F700FF\" face=\"DOCK11\">AQUELE RATOBIRD QUE VOCE RESPEITA</font></p>", nil, 0, 180, 800, nil, true, 7)
- print(string.format("<R>Digite esse comando !%s para poder usar os comandos do RatoBird - Comandos de textarea:!bb-!chola-!brabo-!gjuo-!maluco", _MAIN.command))
- system.disableChatCommandDisplay(_MAIN.command)
- system.disableChatCommandDisplay("chola")
- system.disableChatCommandDisplay("bb")
- system.disableChatCommandDisplay("brabo")
- system.disableChatCommandDisplay("gjuo")
- system.disableChatCommandDisplay("maluco")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement