Advertisement
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 )
- groundsInfo = {tempo = {}, x = {}, y = {}, special={}, necroActive={}, 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", "@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 clearInfo (n)
- groundsInfo.necroActive[n] = false
- groundsInfo.special[n] = nil
- groundsInfo.tempo[n] = 0
- tfm.exec.removePhysicObject(tfm.get.room.playerList[n].id)
- end
- function eventNewGame ()
- tfm.exec.setGameTime ( 300, true )
- table.foreach(tfm.get.room.playerList, clearInfo)
- if tfm.get.room.xmlMapInfo.author:sub(#tfm.get.room.xmlMapInfo.author-4, #tfm.get.room.xmlMapInfo.author-4) == "#" then
- tfm.exec.setUIMapName("<font color='#98E2EB'><b>Bridge</b> - "..tfm.get.room.currentMap.." - <font color='#009D9D'><b>".. tfm.get.room.xmlMapInfo.author:sub(1, #tfm.get.room.xmlMapInfo.author - 5).."<font color='#606090' size='8'>".. tfm.get.room.xmlMapInfo.author:sub(#tfm.get.room.xmlMapInfo.author - 4, #tfm.get.room.xmlMapInfo.author).."</font></b></font>")
- else
- tfm.exec.setUIMapName("<font color='#98E2EB'><b>Bridge</b> - "..tfm.get.room.currentMap.." - <font color='#009D9D'><b>".. tfm.get.room.xmlMapInfo.author.."</b></font>")
- end
- end
- -- pisos especiais vv
- --timer vv
- function timer (n)
- if groundsInfo.special[n] == "bomba" then
- bomba2 (groundsInfo.x[n], groundsInfo.y[n], n)
- elseif groundsInfo.special[n] == "desgaste" then
- desgaste (n)
- end
- groundsInfo.tempo[n] = groundsInfo.tempo[n] - 1
- if (groundsInfo.tempo[n] <= 0) then
- tfm.exec.removePhysicObject(tfm.get.room.playerList[n].id)
- end
- end
- --bomba vv
- function bomba2 (bombX, bombY, n)
- if groundsInfo.tempo[n] == 6 then
- tfm.exec.displayParticle ( 22, bombX, bombY, -1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 22, bombX, bombY, 1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 22, bombX, bombY, 0, 1, 0, 0, nil)
- tfm.exec.displayParticle ( 22, bombX, bombY, 0, -1, 0, 0, nil)
- elseif groundsInfo.tempo[n] == 4 then
- tfm.exec.displayParticle ( 24, bombX, bombY, -1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 24, bombX, bombY, 1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 24, bombX, bombY, 0, 1, 0, 0, nil)
- tfm.exec.displayParticle ( 24, bombX, bombY, 0, -1, 0, 0, nil)
- elseif groundsInfo.tempo[n] == 2 then
- tfm.exec.displayParticle ( 21, bombX, bombY, -1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 21, bombX, bombY, 1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 21, bombX, bombY, 0, 1, 0, 0, nil)
- tfm.exec.displayParticle ( 21, bombX, bombY, 0, -1, 0, 0, nil)
- elseif groundsInfo.tempo[n] == 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[n] = 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 groundsInfo.tempo[n] >= 10 then
- groundsInfo.tempo[n] = groundsInfo.tempo[n] - 2
- tfm.exec.addPhysicObject ( tfm.get.room.playerList[n].id, groundsInfo.x[n], groundsInfo.y[n], { type = 12, width = groundsInfo.tempo[n], height = groundsInfo.tempo[n], foreground = false, friction = 0.2, restitution = 0.1, angle = 0, color=0x573600, miceCollision = true, groundCollision = false})
- tfm.exec.displayParticle ( 3, groundsInfo.x[n], groundsInfo.y[n], 0, 0, 0, 0.1, nil )
- end
- if groundsInfo.tempo[n] >= 20 then
- tfm.exec.displayParticle ( 3, groundsInfo.x[n] - 10, groundsInfo.y[n], 0, 0, 0, 0.1, nil )
- tfm.exec.displayParticle ( 3, groundsInfo.x[n] + 10, groundsInfo.y[n], 0, 0, 0, 0.1, nil )
- elseif (desgasteT == 0) then
- tfm.exec.removePhysicObject (tfm.get.room.playerList[n].id)
- end
- end
- rotacao ()
- function invocarPiso (n)
- if (listaNegra[n] == 1) then
- groundsInfo.special[n] = nil
- groundsInfo.tempo[n] = 12
- tfm.exec.removePhysicObject ( tfm.get.room.playerList[n].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[n]
- local posicaoX = tfm.get.room.playerList[n].x
- local posicaoY = tfm.get.room.playerList[n].y + 14
- groundsInfo.x[n] = posicaoX
- groundsInfo.y[n] = posicaoY
- info.gTime[n] = 10
- local tipo = grounds[math.random(1, #grounds)]
- if (tipo == 100) then
- groundsInfo.special[n] = "bomba"
- groundsInfo.tempo[n] = 7
- tfm.exec.addPhysicObject ( tfm.get.room.playerList[n].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[n] = 0
- tfm.exec.displayParticle ( 37, posicaoX, posicaoY, 0, 0, 0, 0, nil)
- elseif (tipo == 200) then
- groundsInfo.special[n] = "desgaste"
- groundsInfo.tempo[n] = 24
- tfm.exec.addPhysicObject ( tfm.get.room.playerList[n].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
- groundsInfo.special[n] = "necro"
- groundsInfo.necroActive[n] = true
- groundsInfo.necroX[n] = posicaoX
- groundsInfo.necroY[n] = posicaoY
- tfm.exec.addPhysicObject ( tfm.get.room.playerList[n].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[n].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[n].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[n].id, posicaoX, posicaoY, { type = tipo, width = 24, height = 24, foreground = false, friction = fric, restitution = rest, angle = 0, miceCollision = true, groundCollision = false})
- end
- if 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 ( n, codigoTecla, pressionando, posicaoX, posicaoY )
- if (codigoTecla == 32) then
- invocarPiso (n)
- end
- end
- function eventPlayerGetCheese (n)
- giveCoins (n, 15)
- end
- function eventPlayerDied (n)
- if groundsInfo.necroActive[n] then
- tfm.exec.respawnPlayer (n)
- tfm.exec.movePlayer ( n, groundsInfo.necroX[n], groundsInfo.necroY[n], false, 0, 0, 0 )
- tfm.exec.addPhysicObject ( tfm.get.room.playerList[n].id, groundsInfo.necroX[n], groundsInfo.necroY[n] + 15, { type = 12, width = 24, height = 24, foreground = false, friction = 0.2, restitution = 0.1, angle = 0, color=0x3c1960, miceCollision = true, groundCollision = false})
- groundsInfo.tempo[n] = 10
- tfm.exec.displayParticle ( 1, groundsInfo.necroX[n], groundsInfo.necroY[n] -5, -1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 1, groundsInfo.necroX[n], groundsInfo.necroY[n] -5, 1, 0, 0, 0, nil)
- tfm.exec.displayParticle ( 1, groundsInfo.necroX[n], groundsInfo.necroY[n] -5, 0, 1, 0, 0, nil)
- tfm.exec.displayParticle ( 1, groundsInfo.necroX[n], groundsInfo.necroY[n] -5, 0, -1, 0, 0, nil)
- groundsInfo.special[n] = nil
- groundsInfo.necroActive[n] = false
- else
- tfm.exec.respawnPlayer (n)
- end
- end
- -- comandos v
- system.disableChatCommandDisplay ( "start", true )
- system.disableChatCommandDisplay ( "r", true )
- system.disableChatCommandDisplay ( "remove", true )
- system.disableChatCommandDisplay ( "skip", true )
- system.disableChatCommandDisplay ( "map", true )
- function eventChatCommand ( n, comando )
- if comando == "start" then
- start(n)
- elseif comando == "r" then
- tfm.exec.killPlayer(n)
- tfm.exec.respawnPlayer(n)
- elseif comando == "remove" then
- tfm.exec.removePhysicObject(tfm.get.room.playerList[n].id)
- end
- if n == "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 = tonumber(comando:sub(5))
- tfm.exec.newGame(mapas[map], false)
- end
- end
- end
- function eventPlayerWon ( n, tempo, tempoRespawn )
- tfm.exec.respawnPlayer ( n )
- giveCoins (n, 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][n] = shop[shopId][n] + 1
- giveCoins(n, 0 - c)
- openShop(n)
- end
- function giveCoins (n, q)
- info.coins[n] = info.coins[n] + q
- ui.addTextArea ( 74 + tfm.get.room.playerList[n].id, "<b><font color='#ffc700'> © </font>Moedas: </b>"..info.coins[n], 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][n].."/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][n].."/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][n].."/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][n].."/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, n, c )
- if (id == 1) then
- ajuda (n)
- elseif (id == 2) then
- openShop (n)
- elseif (c == 'closeShop') then
- ui.removeTextArea (75 + tfm.get.room.playerList[n].id, n)
- elseif (c == 'shop1') then
- if shop[1][n] <= 4 then
- if info.coins[n] >= 30 then
- inserirPiso (6, 2, n)
- execPurchase (n, 30, 1)
- end
- end
- elseif (c == 'shop2') then
- if shop[2][n] <= 0 then
- if info.coins[n] >= 50 then
- removerPiso (3, 0, n)
- execPurchase (n, 50, 2)
- end
- end
- elseif (c == 'shop3') then
- if shop[3][n] <= 4 then
- if info.coins[n] >= 40 then
- inserirPiso (4, 2, n)
- execPurchase (n, 40, 3)
- end
- end
- elseif (c == 'shop4') then
- if shop[4][n] <= 0 then
- if info.coins[n] >= 80 then
- inserirPiso (300, 1, n)
- execPurchase (n, 80, 4)
- end
- end
- end
- end
- function inserirPiso (id, q, n)
- local gInserted = 0
- repeat
- table.insert(info.pisos[n], id)
- gInserted = gInserted + 1
- until gInserted == q
- end
- function removerPiso (id, q, n)
- local numb = #info.pisos[n]
- local gRemoved = 0
- if q == 0 then
- repeat
- if info.pisos[n][numb] == id then
- table.remove(info.pisos[n], numb)
- end
- numb = numb - 1
- until numb == 0
- else
- repeat
- if info.pisos[n][numb] == id then
- table.remove(info.pisos[n], numb)
- gRemoved = gRemoved + 1
- end
- numb = numb - 1
- until gRemoved == q or numb == 0
- end
- end
- --------------------------------------------------------------------------
- function eventNewPlayer ( n )
- system.bindKeyboard ( n , 32, true, true)
- system.bindKeyboard ( n , 65, true, true)
- tfm.exec.respawnPlayer ( n )
- listaNegra[n] = 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)
- groundsInfo.tempo[n] = 0
- groundsInfo.special[n] = nil
- groundsInfo.x[n] = 0
- groundsInfo.y[n] = 0
- groundsInfo.necroX[n] = 0
- groundsInfo.necroY[n] = 0
- info.pisos[n] = {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[n] = 0
- info.gTime[n] = 0
- ui.addTextArea ( 74 + tfm.get.room.playerList[n].id, "<b><font color='#ffc700'> ©</font> Moedas: </b>"..info.coins[n], n, 95, 376, 0, 0, 0x324650, 0x213540, 1, true)
- local shopTabQ = 0
- repeat
- shopTabQ = shopTabQ + 1
- shop[shopTabQ][n] = 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement