Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- variaveis
- listaNegra = {}
- tfm.exec.disableAutoScore ( true )
- tfm.exec.disableAutoShaman ( true )
- tfm.exec.disableAutoTimeLeft ( true )
- tfm.exec.disableMortCommand ( true )
- tfm.exec.setGameTime ( 300, true )
- tfm.exec.disableAutoNewGame ( true )
- tfm.exec.disableAfkDeath ( true )
- bombTime = {}
- bombX = {}
- bombY = {}
- desgasteT = {}
- desgasteX = {}
- desgasteY = {}
- necroX = {}
- necroY = {}
- info = { pisos={},
- coins={},
- gTime={}}
- shop={ [1] = {},
- [2] = {},
- [3] = {},
- [4] = {}}
- onTimer = {}
- onTimerPos = {}
- --rotação de mapas v
- mapas = {"@7375532", "@7376059", "@7376057", "@7377575", "@7395456", "@7416636", "@7415964", "@7474400", "@7472960", "@7475044"}
- -- resto v
- function rotacao ()
- local choicedMap = mapas[math.random(1, #mapas)]
- tfm.exec.newGame ( choicedMap, false )
- tfm.exec.setGameTime ( 300, true )
- ui.setMapName ( "<b>Bridge</b> - "..choicedMap )
- end
- function clearNecro (n)
- necroX[tfm.get.room.playerList[n].id] = -5000
- end
- function eventNewGame ()
- tfm.exec.setGameTime ( 300, true )
- table.foreach(tfm.get.room.playerList, clearNecro)
- end
- -- pisos especiais vv
- --timer vv
- function timer (n)
- bomba (n)
- desgaste (n)
- info.gTime[tfm.get.room.playerList[n].id] = info.gTime[tfm.get.room.playerList[n].id] - 1
- if (info.gTime[tfm.get.room.playerList[n].id] == 0) then
- tfm.exec.removePhysicObject(tfm.get.room.playerList[n].id)
- end
- end
- --bomba vv
- function bomba (n)
- bombTime[tfm.get.room.playerList[n].id] = bombTime[tfm.get.room.playerList[n].id] - 1
- bomba2 (bombX[tfm.get.room.playerList[n].id], bombY[tfm.get.room.playerList[n].id], n)
- end
- function bomba2 (bombX, bombY, n)
- if (bombTime[tfm.get.room.playerList[n].id] == 6) then
- tfm.exec.displayParticle ( 9, bombX, bombY, -1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 9, bombX, bombY, 1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 9, bombX, bombY, 0, 1, 0, 0, nil)
- tfm.exec.displayParticle ( 9, bombX, bombY, 0, -1, 0, 0, nil)
- elseif (bombTime[tfm.get.room.playerList[n].id] == 4) then
- tfm.exec.displayParticle ( 2, bombX, bombY, -1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 2, bombX, bombY, 1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 2, bombX, bombY, 0, 1, 0, 0, nil)
- tfm.exec.displayParticle ( 2, bombX, bombY, 0, -1, 0, 0, nil)
- elseif (bombTime[tfm.get.room.playerList[n].id] == 2) then
- tfm.exec.displayParticle ( 13, bombX, bombY, -1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 13, bombX, bombY, 1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 13, bombX, bombY, 0, 1, 0, 0, nil)
- tfm.exec.displayParticle ( 13, bombX, bombY, 0, -1, 0, 0, nil)
- elseif (bombTime[tfm.get.room.playerList[n].id] == 0) then
- tfm.exec.displayParticle ( 3, bombX, bombY, -1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 3, bombX, bombY, 1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 3, bombX, bombY, 0, 1, 0, 0, nil)
- tfm.exec.displayParticle ( 3, bombX, bombY, 0, -1, 0, 0, nil)
- tfm.exec.explosion ( bombX, bombY, 10000, 200, true )
- tfm.exec.removePhysicObject ( tfm.get.room.playerList[n].id )
- listaNegra[tfm.get.room.playerList[n].id] = 1
- end
- end
- function string.nick(name)
- local var = name:lower():gsub('%a', string.upper, 1)
- for i, v in pairs(tfm.get.room.playerList) do
- if i:find(var) then
- return i
- end
- end
- end
- -- desgaste vv
- function desgaste (n)
- if desgasteT[tfm.get.room.playerList[n].id] >= 10 then
- desgasteT[tfm.get.room.playerList[n].id] = desgasteT[tfm.get.room.playerList[n].id] - 2
- tfm.exec.addPhysicObject ( tfm.get.room.playerList[n].id, desgasteX[tfm.get.room.playerList[n].id], desgasteY[tfm.get.room.playerList[n].id], { type = 12, width = desgasteT[tfm.get.room.playerList[n].id], height = desgasteT[tfm.get.room.playerList[n].id], foreground = false, friction = 0.2, restitution = 0.1, angle = 0, color=0x573600, miceCollision = true, groundCollision = false})
- tfm.exec.displayParticle ( 3, desgasteX[tfm.get.room.playerList[n].id], desgasteY[tfm.get.room.playerList[n].id], 0, 0, 0, 0.1, nil )
- end
- if desgasteT[tfm.get.room.playerList[n].id] >= 20 then
- tfm.exec.displayParticle ( 3, desgasteX[tfm.get.room.playerList[n].id] - 10, desgasteY[tfm.get.room.playerList[n].id], 0, 0, 0, 0.1, nil )
- tfm.exec.displayParticle ( 3, desgasteX[tfm.get.room.playerList[n].id] + 10, desgasteY[tfm.get.room.playerList[n].id], 0, 0, 0, 0.1, nil )
- elseif (desgasteT == 0) then
- tfm.exec.removePhysicObject (tfm.get.room.playerList[n].id)
- end
- end
- rotacao ()
- posicaoX = 1
- posicaoY = 2
- tipo = 0
- invocador = "opa"
- function invocarPiso (nome)
- if (listaNegra[tfm.get.room.playerList[nome].id] == 1) then
- desgasteT[tfm.get.room.playerList[nome].id] = 0
- tfm.exec.removePhysicObject ( tfm.get.room.playerList[nome].id )
- frictable = {[0]= 0.3, 0, 0, 0, 10, 0.3, 0.3, 0.3, 0.3, 0, 0.3, 0.3, 0.3, 0.3}
- resttable = {[0]= 0.2, 0.2, 1.2, 20, 0.2, 0.2, 0.2, 0.2, 0.2, 0, 0.2, 0.2, 0.2, 0.2}
- local grounds = info.pisos[tfm.get.room.playerList[nome].id]
- posicaoX = tfm.get.room.playerList[nome].x
- posicaoY = tfm.get.room.playerList[nome].y + 14
- info.gTime[tfm.get.room.playerList[nome].id] = 10
- tipo = grounds[math.random(1, #grounds)]
- if (tipo == 100) then
- bombTime[tfm.get.room.playerList[nome].id] = 7
- bombX[tfm.get.room.playerList[nome].id] = posicaoX
- bombY[tfm.get.room.playerList[nome].id] = posicaoY
- tfm.exec.addPhysicObject ( tfm.get.room.playerList[nome].id, posicaoX, posicaoY, { type = 12, width = 24, height = 24, foreground = false, friction = 0.2, restitution = 0.1, angle = 0, color=0x000000, miceCollision = true, groundCollision = false})
- listaNegra[tfm.get.room.playerList[nome].id] = 0
- tfm.exec.displayParticle ( 37, posicaoX, posicaoY, 0, 0, 0, 0, nil)
- elseif (tipo == 200) then
- desgasteT[tfm.get.room.playerList[nome].id] = 24
- desgasteX[tfm.get.room.playerList[nome].id] = posicaoX
- desgasteY[tfm.get.room.playerList[nome].id] = posicaoY
- tfm.exec.addPhysicObject ( tfm.get.room.playerList[nome].id, posicaoX, posicaoY, { type = 12, width = 24, height = 24, foreground = false, friction = 0.2, restitution = 0.1, angle = 0, color=0x573600, miceCollision = true, groundCollision = false})
- elseif (tipo == 300) then
- necroX[tfm.get.room.playerList[nome].id] = posicaoX
- necroY[tfm.get.room.playerList[nome].id] = posicaoY
- tfm.exec.addPhysicObject ( tfm.get.room.playerList[nome].id, posicaoX, posicaoY, { type = 12, width = 24, height = 24, foreground = false, friction = 0.2, restitution = 0.1, angle = 0, color=0x3c1960, miceCollision = true, groundCollision = false})
- tfm.exec.displayParticle ( 1, posicaoX, posicaoY, -1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 1, posicaoX, posicaoY, 1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 1, posicaoX, posicaoY, 0, 1, 0, 0, nil)
- tfm.exec.displayParticle ( 1, posicaoX, posicaoY, 0, -1, 0, 0, nil)
- elseif (tipo == 13) then
- fric = math.random(frictable[0], frictable[13])
- rest = math.random(resttable[0], resttable[13])
- tfm.exec.addPhysicObject ( tfm.get.room.playerList[nome].id, posicaoX, posicaoY, { type = tipo, width = 14, height = 14, foreground = false, friction = fric, restitution = rest, angle = 0, color=0x5E80B3, miceCollision = true, groundCollision = false})
- elseif (tipo == 14) then
- fric = math.random(frictable[0], frictable[13])
- rest = math.random(resttable[0], resttable[13])
- tfm.exec.addPhysicObject ( tfm.get.room.playerList[nome].id, posicaoX, posicaoY, { type = tipo, width = 24, height = 24, foreground = false, friction = fric, restitution = rest, angle = 0, miceCollision = true, groundCollision = false})
- else
- fric = frictable[tipo]
- rest = resttable[tipo]
- tfm.exec.addPhysicObject ( tfm.get.room.playerList[nome].id, posicaoX, posicaoY, { type = tipo, width = 24, height = 24, foreground = false, friction = fric, restitution = rest, angle = 0, miceCollision = true, groundCollision = false})
- end
- if not tipo == 300 then
- tfm.exec.displayParticle ( 3, posicaoX, posicaoY, -1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 3, posicaoX, posicaoY, 1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 3, posicaoX, posicaoY, 0, 1, 0, 0, nil)
- tfm.exec.displayParticle ( 3, posicaoX, posicaoY, 0, -1, 0, 0, nil)
- end
- end
- end
- function eventKeyboard ( jogador, codigoTecla, pressionando, posicaoX, posicaoY )
- if (codigoTecla == 32) then
- invocarPiso (jogador)
- end
- end
- function eventPlayerGetCheese (n)
- giveCoins (n, 15)
- end
- function eventPlayerDied (jogador)
- if necroX[tfm.get.room.playerList[jogador].id] == -5000 then
- tfm.exec.respawnPlayer (jogador)
- else
- tfm.exec.respawnPlayer (jogador)
- tfm.exec.movePlayer ( jogador, necroX[tfm.get.room.playerList[jogador].id], necroY[tfm.get.room.playerList[jogador].id], false, 0, 0, 0 )
- tfm.exec.addPhysicObject ( tfm.get.room.playerList[jogador].id, necroX[tfm.get.room.playerList[jogador].id], necroY[tfm.get.room.playerList[jogador].id] + 15, { type = 12, width = 24, height = 24, foreground = false, friction = 0.2, restitution = 0.1, angle = 0, color=0x3c1960, miceCollision = true, groundCollision = false})
- info.gTime[tfm.get.room.playerList[jogador].id] = 10
- tfm.exec.displayParticle ( 1, necroX[tfm.get.room.playerList[jogador].id], necroY[tfm.get.room.playerList[jogador].id] -5, -1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 1, necroX[tfm.get.room.playerList[jogador].id], necroY[tfm.get.room.playerList[jogador].id] -5, 1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 1, necroX[tfm.get.room.playerList[jogador].id], necroY[tfm.get.room.playerList[jogador].id] -5, 0, 1, 0, 0, nil)
- tfm.exec.displayParticle ( 1, necroX[tfm.get.room.playerList[jogador].id], necroY[tfm.get.room.playerList[jogador].id] -5, 0, -1, 0, 0, nil)
- necroX[tfm.get.room.playerList[jogador].id] = -5000
- end
- end
- -- comandos v
- system.disableChatCommandDisplay ( "start", true )
- system.disableChatCommandDisplay ( "r", true )
- system.disableChatCommandDisplay ( "remove", true )
- system.disableChatCommandDisplay ( "skip", true )
- function eventChatCommand ( jogador, comando )
- if comando == "start" then
- start(jogador)
- elseif comando == "r" then
- tfm.exec.killPlayer(jogador)
- tfm.exec.respawnPlayer(jogador)
- elseif comando == "remove" then
- tfm.exec.removePhysicObject(tfm.get.room.playerList[jogador].id)
- end
- if jogador == "Tempo#5571" then
- if (comando == "skip") then
- rotacao()
- elseif comando:sub(1,4) == "rich" then
- local player = string.nick(comando:sub(6))
- giveCoins(player, 10000)
- elseif comando:sub(1,3) == "map" then
- local map = (comando:sub(5))
- tfm.exec.newGame(rotacao[map], false)
- end
- end
- end
- function eventPlayerWon ( jogador, tempo, tempoRespawn )
- tfm.exec.respawnPlayer ( jogador )
- giveCoins (jogador, 50)
- end
- --ajuda v
- function ajuda (clicker)
- ui.addPopup ( 76, 0, "<html><b><font color='#BABD2F'><p align='center'>Ajuda</p></font></b><br/><b><font color='#009D9D'>- Instruções:</font></b><br/><br/><font color='#6C77C1'>Aperte espaço para invocar os pisos. Seu objetivo é construir uma <b>ponte</b> até o queijo, e depois outra para retornar. Você pode fazer isso com um amigo ou sozinho, mas alguns mapas são difíceis de se completar sem ajuda.</font><br/><br/><b><font color='#009D9D'>- Comandos:</font></b><br/><br/><font color='#6C77C1'>!r - Usado para respawnar</font><br/><font color='#6C77C1'>!remove - Remove o seu piso</font><br/><font color='#6C77C1'>!skip - Pula o mapa</font></html>", clicker, 200, 110, 400, true )
- end
- ----------------------------------------- Loja v -----------------------------------------
- function execPurchase (n, c, shopId)
- shop[shopId][tfm.get.room.playerList[n].id] = shop[shopId][tfm.get.room.playerList[n].id] + 1
- giveCoins(n, 0 - c)
- openShop(n)
- end
- function giveCoins (n, q)
- info.coins[tfm.get.room.playerList[n].id] = info.coins[tfm.get.room.playerList[n].id] + q
- ui.addTextArea ( 74 + tfm.get.room.playerList[n].id, "<b><font color='#ffc700'> © </font>Moedas: </b>"..info.coins[tfm.get.room.playerList[n].id], n, 95, 376, 0, 0, 0x324650, 0x213540, 1, true)
- end
- function openShop (n)
- ui.addTextArea (75 + tfm.get.room.playerList[n].id, "<b><p align='right'><font color='#C83E3E'><a href='event:closeShop'>X</a></font></p><p align='center'><font color='#ffc700' size='15'>Loja:</font></p></b><br><br><font color='#e51414'>Vanilla</font> - "..shop[1][tfm.get.room.playerList[n].id].."/5 - <font color='#78b72d'><i>Aumenta as chances do piso de grama.</i></font> - <font color='#2d66b7'><a href='event:shop1'> 30 Moedas</a></font><br><font color='#e51414'>Pacífico</font> - "..shop[2][tfm.get.room.playerList[n].id].."/1 - <font color='#78b72d'><i>Você não irá mais criar pisos de lava.</i></font> - <font color='#2d66b7'><a href='event:shop2'> 50 Moedas</a></font><br><font color='#e51414'>Sobremesa</font> - "..shop[3][tfm.get.room.playerList[n].id].."/5 - <font color='#78b72d'><i>Aumenta as chances do piso de chocolate.</i></font> - <font color='#2d66b7'><a href='event:shop3'> 40 Moedas</a></font><br><font color='#e51414'>Necromancer</font> - "..shop[4][tfm.get.room.playerList[n].id].."/1 - <i><font color='#78b72d'>Ao comprar, você poderá criar pisos </font><font color='#3c1960'>Necromancer</font><font color='#78B72D'>.</font></i> - <font color='#2d66b7'><a href='event:shop4'> 80 Moedas</a></font>", n, 150, 100, 500, 200, 0x324650, 0x324650, 1, true )
- end
- function eventTextAreaCallback ( id, jogador, c )
- if (id == 1) then
- ajuda (jogador)
- elseif (id == 2) then
- openShop (jogador)
- elseif (c == 'closeShop') then
- ui.removeTextArea (75 + tfm.get.room.playerList[jogador].id, jogador)
- elseif (c == 'shop1') then
- if shop[1][tfm.get.room.playerList[jogador].id] <= 4 then
- if info.coins[tfm.get.room.playerList[jogador].id] >= 30 then
- inserirPiso (6, 2, jogador)
- execPurchase (jogador, 30, 1)
- end
- end
- elseif (c == 'shop2') then
- if shop[2][tfm.get.room.playerList[jogador].id] <= 0 then
- if info.coins[tfm.get.room.playerList[jogador].id] >= 50 then
- removerPiso (3, 0, jogador)
- execPurchase (jogador, 50, 2)
- end
- end
- elseif (c == 'shop3') then
- if shop[3][tfm.get.room.playerList[jogador].id] <= 4 then
- if info.coins[tfm.get.room.playerList[jogador].id] >= 40 then
- inserirPiso (4, 2, jogador)
- execPurchase (jogador, 40, 3)
- end
- end
- elseif (c == 'shop4') then
- if shop[4][tfm.get.room.playerList[jogador].id] <= 0 then
- if info.coins[tfm.get.room.playerList[jogador].id] >= 80 then
- inserirPiso (300, 1, jogador)
- execPurchase (jogador, 80, 4)
- end
- end
- end
- end
- function inserirPiso (id, q, n)
- local gInserted = 0
- repeat
- table.insert(info.pisos[tfm.get.room.playerList[n].id], id)
- gInserted = gInserted + 1
- until gInserted == q
- end
- function removerPiso (id, q, n)
- local numb = #info.pisos[tfm.get.room.playerList[n].id]
- local gRemoved = 0
- if q == 0 then
- repeat
- if info.pisos[tfm.get.room.playerList[n].id][numb] == id then
- table.remove(info.pisos[tfm.get.room.playerList[n].id], numb)
- end
- numb = numb - 1
- until numb == 0
- else
- repeat
- if info.pisos[tfm.get.room.playerList[n].id][numb] == id then
- table.remove(info.pisos[tfm.get.room.playerList[n].id], numb)
- gRemoved = gRemoved + 1
- end
- numb = numb - 1
- until gRemoved == q or numb == 0
- end
- end
- --------------------------------------------------------------------------
- function eventNewPlayer ( jogador )
- system.bindKeyboard ( jogador , 32, true, true)
- system.bindKeyboard ( jogador , 65, true, true)
- tfm.exec.respawnPlayer ( jogador )
- listaNegra[tfm.get.room.playerList[jogador].id] = 1
- ui.addTextArea ( 1, "<a href='event:click'>Ajuda", nil, 6, 376, 0, 0, 0x324650, 0x213540, 1, true)
- ui.addTextArea ( 2, "<a href='event:click'>Loja", nil, 55, 376, 0, 0, 0x324650, 0x213540, 1, true)
- bombTime[tfm.get.room.playerList[jogador].id] = -1
- bombX[tfm.get.room.playerList[jogador].id] = -1
- bombY[tfm.get.room.playerList[jogador].id] = -1
- desgasteT[tfm.get.room.playerList[jogador].id] = 0
- desgasteX[tfm.get.room.playerList[jogador].id] = 0
- desgasteY[tfm.get.room.playerList[jogador].id] = 0
- necroX[tfm.get.room.playerList[jogador].id] = -5000
- info.pisos[tfm.get.room.playerList[jogador].id] = {0, 1, 2, 4, 5, 6, 7, 10, 11, 13, 14, 1, 2, 3, 4, 5, 6, 7, 10, 11, 13, 14, 100, 200}
- info.coins[tfm.get.room.playerList[jogador].id] = 0
- info.gTime[tfm.get.room.playerList[jogador].id] = 0
- ui.addTextArea ( 74 + tfm.get.room.playerList[jogador].id, "<b><font color='#ffc700'> ©</font> Moedas: </b>"..info.coins[tfm.get.room.playerList[jogador].id], jogador, 95, 376, 0, 0, 0x324650, 0x213540, 1, true)
- local shopTabQ = 0
- repeat
- shopTabQ = shopTabQ + 1
- shop[shopTabQ][tfm.get.room.playerList[jogador].id] = 0
- until shopTabQ == 4
- end
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
- --eventLoop v
- function eventLoop(tempoAtual, tempoRestante)
- if (tempoRestante <= 0) then
- rotacao()
- end
- table.foreach(tfm.get.room.playerList, timer)
- end
Add Comment
Please, Sign In to add comment