Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Criador: Nettoork#0000
- Versão: 1.1 [23/12/2020]
- Descrição: Esse script é uma paródia do "Chão é lava".
- ]]--
- -- Variáveis modificáveis
- local admins = {} -- Não é necessário por seu nickname, apenas de outras pessoas
- local maps = {7214563, 7792590}
- local objects = {1, 2, 3, 4, 6, 7, 10, 39, 59, 60, 62, 68}
- local translations = {
- ["br"] = {
- ["adminWelcome"] = "<CH>Seja bem-vindo(a) ao <font color='#2CC5D9'><B>O chão é água</B></font>! Utilize !help para ver seus comandos de administrador.</CH>",
- ["welcome"] = "<CH>Seja bem-vindo(a) ao <font color='#2CC5D9'><B>O chão é água</B></font>! Cuidado para não afundar ;)</CH>",
- ["startMinigame"] = "Inicie o minigame",
- ["stopMinigame"] = "Pare o minigame",
- ["avaliableCommands"] = "<ROSE>Você tem disponível %d comando(s):</ROSE>",
- ["starting"] = "<VP>O minigame foi iniciado.</VP>",
- ["stoping"] = "<VP>O minigame foi parado.</VP>",
- ["playerWon"] = "%s\n\n\n<font size='50' color='#FFFF00'>%s venceu!</font>",
- ["nobodyWon"] = "<font size='50' color='#FFFF00'>Ninguém venceu!</font>",
- ["gameName"] = "<p align='center'><font size='50' color='#2FDDF9'>O CHÃO É ÁGUA</font></p>",
- ["nextMap"] = "Avançar para o próximo mapa"
- }
- }
- -- Não mexa a partir daqui
- do
- local _, nickname = pcall(nil)
- table.insert(admins, string.match(nickname, "(.-)%."))
- end
- local game = {
- mapDelay = 0,
- mapCache = {},
- needNext = false,
- isEnding = false,
- language = translations[tfm.get.room.community] and tfm.get.room.community or "br",
- timer = os.time(),
- stage = 1,
- isEnding = false,
- canPlay = false,
- spawned = false,
- time = 60,
- objects = {}
- }
- local tableStringToTable = function(tableC)
- local finalTable = {}
- for i, v in next, tableC do
- finalTable[v] = true
- end
- return finalTable
- end
- local split = function(t, s)
- local a={}
- for i in string.gmatch(t, "[^" .. (s or "%s") .. "]+") do
- a[#a + 1] = i
- end
- return a
- end
- admins = tableStringToTable(admins)
- function getMessage(message, ...)
- return translations[game.language][message] and translations[game.language][message]:format(...) or "Message not found"
- end
- local commands, command_list, command_length = {
- ["start"] = {desc = getMessage("startMinigame")},
- ["stop"] = {desc = getMessage("stopMinigame")},
- ["next"] = {desc = getMessage("nextMap")}
- }, '', 0
- for i in next, commands do
- system.disableChatCommandDisplay(i)
- command_length = command_length + 1
- command_list = ('%s\n<J>!%s</J><BL>%s %s</BL>'):format(command_list, i, commands[i].options and ' <V>'..commands[i].options..'</V>' or '', commands[i].desc and ': '..commands[i].desc or '')
- end
- function spawnObjects()
- for i = 1, math.ceil((game.time / 10 > 1 and game.time / 10 or 1)) do
- local object = objects[math.random(1, #objects)]
- game.objects[#game.objects + 1] = tfm.exec.addShamanObject(object, math.random(100, 1500), 360, object == 62 and object or 0, 0, 0, object == 62)
- end
- end
- function removeObjects()
- for i, v in next, game.objects do
- tfm.exec.removeObject(v)
- end
- game.objects = {}
- end
- function nextMap()
- if game.mapDelay and os.time() < game.mapDelay then
- game.needNext = true
- else
- game.needNext = false
- game.mapDelay = os.time() + 3500
- if game.nextMap then
- tfm.exec.newGame(game.nextMap)
- game.nextMap = false
- else
- if #game.mapCache == 0 then
- for index, map in next, maps do
- game.mapCache[#game.mapCache + 1] = map
- end
- end
- tfm.exec.newGame(table.remove(game.mapCache, math.random(#game.mapCache)), math.random(1, 5) == 1 and true or false)
- end
- end
- end
- function showMessage(message)
- ui.addTextArea(1, "<p align='center'>"..message.."</p>", nil, 5, 125, 790, 0, 0, 0, 0, true)
- end
- function checkPlayers()
- if game.canPlay then
- local alive = 0
- for name, data in next, tfm.get.room.playerList do
- if not data.isDead then
- alive = alive + 1
- end
- end
- if alive <= 1 then
- if alive <= 0 then
- showMessage(getMessage("nobodyWon"))
- else
- for name, data in next, tfm.get.room.playerList do
- if not data.isDead then
- tfm.exec.giveCheese(name, true)
- tfm.exec.playerVictory(name)
- showMessage(getMessage("playerWon", getMessage("gameName"), name))
- break
- end
- end
- end
- game.stage = 100
- game.timer = os.time()
- end
- end
- end
- function setGround(name)
- if name == "dirt" then
- tfm.exec.addPhysicObject(1, 800, 387, {type = 6, width = 1600, height = 37, foreground = false, friction = 0.3, restitution = 0.2, angle = 0, miceCollision = true, groundCollision = true})
- elseif name == "water" then
- tfm.exec.addPhysicObject(1, 800, 387, {fixedRotation = true, dynamic = true, angularDamping = 99999, linearDamping = 99999, mass = 99999, type = 9, width = 1600, height = 37, foreground = false, friction = 0.3, restitution = 0.2, angle = 0, miceCollision = false, groundCollision = true})
- end
- end
- function eventLoop(t1, t2)
- local timer = os.time() - game.timer
- game.time = math.floor(t2/1000)
- if game.canPlay then
- if t1 >= 35000 and t2 <= 36000 then
- table.foreach(tfm.get.room.playerList, tfm.exec.giveMeep)
- end
- if game.stage == 1 then
- if timer > 2000 then
- game.stage = 2
- game.timer = os.time()
- end
- elseif game.stage == 2 then
- local number = math.floor(timer/1000)
- local maxTime = 10
- if maxTime - number <= 0 then
- game.stage = 3
- game.timer = os.time()
- ui.removeTextArea(1)
- setGround("water")
- showMessage(getMessage("gameName"))
- else
- if maxTime - number == 4 and not game.spawned then
- game.spawned = true
- spawnObjects()
- end
- ui.addTextArea(1, "<font size='90'><p align='center'>"..(maxTime - number).."</p></font>", nil, 5, 125, 790, 290, 1, 1, 0, true)
- end
- elseif game.stage == 3 then
- if timer >= 4000 then
- setGround("dirt")
- ui.removeTextArea(1)
- game.spawned = false
- game.stage = 1
- game.timer = os.time()
- removeObjects()
- end
- elseif game.stage == 100 then
- if timer >= 6000 then
- nextMap()
- end
- end
- end
- if game.needNext then
- nextMap()
- end
- end
- function eventChatCommand(name, command)
- local arg = split(command, " ")
- if admins[name] then
- if arg[1] == "start" and not game.canPlay then
- tfm.exec.chatMessage(getMessage("starting"), name)
- game.canPlay = true
- nextMap()
- elseif arg[1] == "stop" and game.canPlay then
- tfm.exec.chatMessage(getMessage("stoping"), name)
- game.canPlay = false
- ui.removeTextArea(1)
- nextMap()
- elseif arg[1] == "help" then
- tfm.exec.chatMessage(getMessage("avaliableCommands", command_length) .. command_list, name)
- elseif arg[1] == "check" then
- checkPlayers()
- elseif arg[1] == "next" then
- nextMap()
- end
- end
- end
- function eventNewGame()
- setGround("dirt")
- ui.removeTextArea(1)
- tfm.exec.setGameTime(60)
- game.stage = 1
- game.timer = os.time()
- game.time = 60
- game.spawned = false
- end
- function eventNewPlayer(name)
- if admins[name] then
- tfm.exec.chatMessage(getMessage("adminWelcome"), name)
- else
- tfm.exec.chatMessage(getMessage("welcome"), name)
- end
- end
- eventPlayerDied = checkPlayers
- eventPlayerLeft = checkPlayers
- system.disableChatCommandDisplay();
- for index, value in next, {'AutoShaman', 'AutoNewGame', 'AutoTimeLeft', 'AutoScore', 'PhysicalConsumables', 'DebugCommand', 'MinimalistMode'} do
- tfm.exec['disable' .. value]()
- end
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
- nextMap()
Add Comment
Please, Sign In to add comment