Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- baseXML = [[
- <C><P DS="y;90" Ca="" /><Z><S><S P="0,0,9999,0.2,0,0,0,0" L="800" o="0" H="10" v="3000" Y="110" T="12" X="400" /><S L="800" o="fffffffff" H="10" X="400" v="3000" Y="70" T="12" P="0,0,9999,0.2,0,0,0,0" /><S P="0,0,9999,0.2,0,0,0,0" L="50" o="0" X="400" Y="-200" T="12" H="10" /><S L="50" o="0" X="400" H="10" Y="-240" T="12" P="0,0,9999,0.2,0,0,0,0" /><S P="0,0,9999,0.2,90,0,0,0" L="50" o="0" H="10" Y="-220" T="12" X="430" /><S L="50" o="0" H="10" X="370" Y="-220" T="12" P="0,0,9999,0.2,90,0,0,0" /></S><D><DS Y="90" X="400" /></D><O /></Z></C>
- ]]
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoScore(true)
- tfm.exec.disableAutoTimeLeft(true)
- system.disableChatCommandDisplay("afk")
- maps = {"@4535536","@4535536","@4533657","@4535757","@4535960","@4537526","@4537526","@4537526","@4537528","@4537632"}
- players = {}
- afk = {}
- spawnFrequency = 1
- spiritFrequency = 4
- cannonFrequency = 5
- delayUnfrequency = 5
- spiritTime = 20
- cannonTime = 40
- lang = {}
- lang.fr = {
- info = "Bubbles !",
- afk = "<N>Estas<J>AFK<N>.¿Estas de vuelta? Escribe : <ROSE>!afk<N>."
- }
- lang.en = {
- info = "Bubbles !",
- afk = "<N>Estas <J>AFK<N>. ¿Estas de vuelta? Escribe : <ROSE>!afk<N>."
- }
- text = lang.fr
- timer = {
- start = 0,
- frequence = 0,
- unfrequence = 0
- }
- bubbles = {}
- function eventNewGame()
- bubbles = {}
- players = {}
- spawnFrequency = 0.5
- for timerName,value in pairs(timer) do
- timer[timerName] = 0
- end
- for n,p in pairs(tfm.get.room.playerList) do
- table.insert(players, n)
- end
- local bestPlayer = bestPlayer()
- tfm.exec.setUIMapName("<PT>"..text.info.." <font color='#60608F'>|</font> <N>!Maestro Bubble : <VP>"..bestPlayer)
- for _,p in pairs(players) do
- if afk[p] then
- tfm.exec.movePlayer(p, 400, -200, false, 0, 0, false)
- else
- tfm.exec.movePlayer(p, math.random(100, 700), 90, false, 0, 0, false)
- end
- end
- showAfk()
- end
- function eventNewPlayer(playerName)
- table.insert(players, playerName)
- afk[playerName] = false
- end
- function eventPlayerLeft(playerName)
- local toRemove = 0
- for i,p in pairs(players) do
- if p==playerName then
- toRemove = i
- end
- end
- table.remove(players, toRemove)
- afk[playerName] = false
- end
- function eventPlayerDied(playerName)
- if #players > 1 then
- local alive = 0
- local pname = ""
- for _,p in pairs(players) do
- if not tfm.get.room.playerList[p].isDead and not afk[p] and tfm.get.room.playerList[p].y > 0 then
- alive = alive + 1
- pname = p
- end
- end
- if alive == 1 then
- tfm.exec.giveCheese(pname)
- tfm.exec.playerVictory(pname)
- tfm.exec.setGameTime(5)
- elseif alive == 0 then
- newGame()
- end
- else
- newGame()
- end
- end
- function eventPlayerWon(playerName)
- if playerName == bestPlayer() then
- tfm.exec.setPlayerScore(playerName, 5, true)
- else
- tfm.exec.setPlayerScore(playerName, 16, true)
- end
- end
- function eventLoop(currentTime, timeRemaining)
- timer.start = timer.start + 0.5
- if timeRemaining <= 0 then
- for _,p in pairs(players) do
- if not tfm.get.room.playerList[p].isDead and not afk[p] then
- tfm.exec.giveCheese(p)
- tfm.exec.playerVictory(p)
- end
- end
- newGame()
- end
- if timer.start > 40 and (timer.start % 52) == 0 and tfm.get.room.currentMap == "@4537632" then
- tfm.exec.snow()
- end
- if timer.start > spiritTime then
- if (timer.start % spiritFrequency) == 0 then
- local nbAfk = math.random(#bubbles)
- local target = bubbles[nbAfk]
- tfm.exec.addShamanObject(24, tfm.get.room.objectList[target].x, tfm.get.room.objectList[target].y, 0, 0, 0, false)
- tfm.exec.removeObject(target)
- table.remove(bubbles, nbAfk)
- end
- end
- if timer.start > cannonTime then
- if (timer.start % cannonFrequency) == 0 then
- tfm.exec.addShamanObject(18, math.random(30, 770), 20, 0, 0, 75, false)
- end
- end
- for _,p in pairs(players) do
- if not tfm.get.room.playerList[p].isDead then
- if tfm.get.room.playerList[p].x < 0 or tfm.get.room.playerList[p].x > 800 or tfm.get.room.playerList[p].y < 10 then
- if tfm.get.room.playerList[p].y > -150 then
- tfm.exec.movePlayer(p, 400, 500, false, 0, 0, false)
- end
- end
- end
- end
- timer.frequence = timer.frequence + 0.5
- if timer.frequence >= spawnFrequency then
- timer.frequence = 0
- timer.unfrequence = timer.unfrequence + 0.5
- if timer.unfrequence == delayUnfrequency and spawnFrequency < 2 then
- timer.unfrequence = 0
- spawnFrequency = spawnFrequency + 0.5
- end
- spawnBubble()
- end
- for i,id in pairs(bubbles)do
- if tfm.get.room.objectList[id] and tfm.get.room.objectList[id].y<=20 then
- tfm.exec.removeObject(id)
- table.remove(bubbles, i)
- end
- end
- end
- function eventChatCommand(playerName, message)
- if message == "afk" and timer.start > 3 then
- toggleAfk(playerName)
- end
- end
- function toggleAfk(playerName)
- for p,v in pairs(afk) do
- if p == playerName then
- if v then
- afk[p] = false
- if #players == 1 then
- newGame()
- else
- local diff = 0
- for p,v in pairs(afk) do
- if v then
- diff = diff + 1
- end
- end
- if #players - diff == 1 then
- newGame()
- end
- end
- else
- afk[p] = true
- tfm.exec.movePlayer(p, 400, -200, false, 0, 0, false)
- if #players > 1 then
- local alive = 0
- local pname = ""
- for _,p in pairs(players) do
- if not tfm.get.room.playerList[p].isDead and not afk[p] and tfm.get.room.playerList[p].y > 0 then
- alive = alive + 1
- pname = p
- end
- end
- if alive == 1 then
- tfm.exec.giveCheese(pname)
- tfm.exec.playerVictory(pname)
- tfm.exec.setGameTime(5)
- elseif alive == 0 then
- newGame()
- end
- else
- newGame()
- end
- end
- end
- end
- showAfk()
- end
- function showAfk()
- local nbAfk = 0
- local nbNonAfk = 0
- local nbPreAfk = 0
- local message = ""
- while nbAfk <= #players do
- ui.removeTextArea(nbAfk)
- nbAfk = nbAfk + 1
- end
- while nbNonAfk <= #players do
- ui.removeTextArea(nbNonAfk)
- nbNonAfk = nbNonAfk + 1
- end
- nbAfk = 0
- nbNonAfk = 0
- for p,v in pairs(afk) do
- if v then nbPreAfk = nbPreAfk + 1 end
- end
- for p,v in pairs(afk) do
- if v then
- ui.addTextArea(nbAfk, "<p align='center'>"..text.afk.."</p>", p, 0, 22, 800, 20, 0x010101, 0x010101, 0.7f)
- nbAfk = nbAfk + 1
- if nbAfk == nbPreAfk then
- if nbAfk == 1 then
- message = message.."<J>"..p.."<N> est AFK."
- else
- message = message.."<N>et <J>"..p.."<N> sont AFK."
- end
- else
- message = message.."<J>"..p.."<N>, "
- end
- end
- end
- for p,v in pairs(afk) do
- if not v and nbAfk > 0 then
- ui.addTextArea(nbNonAfk, "<p align='center'>"..message.."</p>", p, 0, 22, 800, 20, 0x010101, 0x010101, 0.7f)
- nbNonAfk = nbNonAfk + 1
- end
- end
- end
- function spawnBubble()
- local id
- id = tfm.exec.addShamanObject(59, math.random(30, 770), 400, 0, 0, 0, false)
- table.insert(bubbles, id)
- end
- function newGame()
- local map = tfm.get.room.currentMap
- if map == "@4537632" then -- Map neige
- tfm.exec.snow()
- end
- if #maps > 1 then
- while map == tfm.get.room.currentMap do
- map = maps[math.random(#maps)]
- end
- else
- map = maps[math.random(#maps)]
- end
- tfm.exec.newGame(map)
- if map == "@4537632" then -- Map neige
- tfm.exec.snow()
- end
- end
- function bestPlayer()
- local topScore = 16
- local bestPlayer = "-"
- for name,player in pairs(tfm.get.room.playerList) do
- if player.score >= topScore then
- topScore = player.score
- bestPlayer = name
- end
- end
- return bestPlayer
- end
- for name,player in pairs(tfm.get.room.playerList) do
- tfm.exec.setPlayerScore(name, 0, false)
- afk[name] = false
- end
- newGame()
- -- Fréquence de spawn des boulets
- cannonFrequency = 5
- -- Nombre de secondes avant que la fréquence de spawn des bulles ne baisse
- delayUnfrequency = 5
- -- Nombre de secondes avant que les esprits n'apparaîssent
- spiritTime = 20
- -- Nombre de secondes avant que les boulets n'apparaissent
- cannonTime = 40
- lang = {}
- lang.fr = {
- info = "Bubbles !",
- afk = "<N>!Estas<J>AFK<N>.¿Estas de vuelta? Escribe : <ROSE>!afk<N>."
- }
- lang.en = {
- info = "Bubbles !",
- afk = "<N>Estas <J>AFK<N>. Escribe : <ROSE>!afk<N> para volver a modo normal."
- }
- text = lang.fr
- timer = {
- start = 0,
- frequence = 0,
- unfrequence = 0
- }
- bubbles = {}
- function eventNewGame()
- bubbles = {}
- players = {}
- spawnFrequency = 0.5
- for timerName,value in pairs(timer) do
- timer[timerName] = 0
- end
- for n,p in pairs(tfm.get.room.playerList) do
- table.insert(players, n)
- end
- local bestPlayer = bestPlayer()
- tfm.exec.setUIMapName("<PT>"..text.info.." <font color='#60608F'>|</font> <N>!Maestro bubble : <VP>"..bestPlayer)
- for _,p in pairs(players) do
- if afk[p] then
- tfm.exec.movePlayer(p, 400, -200, false, 0, 0, false)
- else
- tfm.exec.movePlayer(p, math.random(100, 700), 90, false, 0, 0, false)
- end
- end
- showAfk()
- end
- function eventNewPlayer(playerName)
- table.insert(players, playerName)
- afk[playerName] = false
- end
- function eventPlayerLeft(playerName)
- local toRemove = 0
- for i,p in pairs(players) do
- if p==playerName then
- toRemove = i
- end
- end
- table.remove(players, toRemove)
- afk[playerName] = false
- end
- function eventPlayerDied(playerName)
- if #players > 1 then
- local alive = 0
- local pname = ""
- for _,p in pairs(players) do
- if not tfm.get.room.playerList[p].isDead and not afk[p] and tfm.get.room.playerList[p].y > 0 then
- alive = alive + 1
- pname = p
- end
- end
- if alive == 1 then
- tfm.exec.giveCheese(pname)
- tfm.exec.playerVictory(pname)
- tfm.exec.setGameTime(5)
- elseif alive == 0 then
- newGame()
- end
- else
- newGame()
- end
- end
- function eventPlayerWon(playerName)
- if playerName == bestPlayer() then
- tfm.exec.setPlayerScore(playerName, 5, true)
- else
- tfm.exec.setPlayerScore(playerName, 16, true)
- end
- end
- function eventLoop(currentTime, timeRemaining)
- timer.start = timer.start + 0.5
- if timeRemaining <= 0 then
- for _,p in pairs(players) do
- if not tfm.get.room.playerList[p].isDead and not afk[p] then
- tfm.exec.giveCheese(p)
- tfm.exec.playerVictory(p)
- end
- end
- newGame()
- end
- if timer.start > 40 and (timer.start % 52) == 0 and tfm.get.room.currentMap == "@4537632" then
- tfm.exec.snow()
- end
- if timer.start > spiritTime then
- if (timer.start % spiritFrequency) == 0 then
- local nbAfk = math.random(#bubbles)
- local target = bubbles[nbAfk]
- tfm.exec.addShamanObject(24, tfm.get.room.objectList[target].x, tfm.get.room.objectList[target].y, 0, 0, 0, false)
- tfm.exec.removeObject(target)
- table.remove(bubbles, nbAfk)
- end
- end
- if timer.start > cannonTime then
- if (timer.start % cannonFrequency) == 0 then
- tfm.exec.addShamanObject(18, math.random(30, 770), 20, 0, 0, 75, false)
- end
- end
- for _,p in pairs(players) do
- if not tfm.get.room.playerList[p].isDead then
- if tfm.get.room.playerList[p].x < 0 or tfm.get.room.playerList[p].x > 800 or tfm.get.room.playerList[p].y < 10 then
- if tfm.get.room.playerList[p].y > -150 then
- tfm.exec.movePlayer(p, 400, 500, false, 0, 0, false)
- end
- end
- end
- end
- timer.frequence = timer.frequence + 0.5
- if timer.frequence >= spawnFrequency then
- timer.frequence = 0
- timer.unfrequence = timer.unfrequence + 0.5
- if timer.unfrequence == delayUnfrequency and spawnFrequency < 2 then
- timer.unfrequence = 0
- spawnFrequency = spawnFrequency + 0.5
- end
- spawnBubble()
- end
- for i,id in pairs(bubbles)do
- if tfm.get.room.objectList[id] and tfm.get.room.objectList[id].y<=20 then
- tfm.exec.removeObject(id)
- table.remove(bubbles, i)
- end
- end
- end
- function eventChatCommand(playerName, message)
- if message == "afk" and timer.start > 3 then
- toggleAfk(playerName)
- end
- end
- function toggleAfk(playerName)
- for p,v in pairs(afk) do
- if p == playerName then
- if v then
- afk[p] = false
- if #players == 1 then
- newGame()
- else
- local diff = 0
- for p,v in pairs(afk) do
- if v then
- diff = diff + 1
- end
- end
- if #players - diff == 1 then
- newGame()
- end
- end
- else
- afk[p] = true
- tfm.exec.movePlayer(p, 400, -200, false, 0, 0, false)
- if #players > 1 then
- local alive = 0
- local pname = ""
- for _,p in pairs(players) do
- if not tfm.get.room.playerList[p].isDead and not afk[p] and tfm.get.room.playerList[p].y > 0 then
- alive = alive + 1
- pname = p
- end
- end
- if alive == 1 then
- tfm.exec.giveCheese(pname)
- tfm.exec.playerVictory(pname)
- tfm.exec.setGameTime(5)
- elseif alive == 0 then
- newGame()
- end
- else
- newGame()
- end
- end
- end
- end
- showAfk()
- end
- function showAfk()
- local nbAfk = 0
- local nbNonAfk = 0
- local nbPreAfk = 0
- local message = ""
- while nbAfk <= #players do
- ui.removeTextArea(nbAfk)
- nbAfk = nbAfk + 1
- end
- while nbNonAfk <= #players do
- ui.removeTextArea(nbNonAfk)
- nbNonAfk = nbNonAfk + 1
- end
- nbAfk = 0
- nbNonAfk = 0
- for p,v in pairs(afk) do
- if v then nbPreAfk = nbPreAfk + 1 end
- end
- for p,v in pairs(afk) do
- if v then
- ui.addTextArea(nbAfk, "<p align='center'>"..text.afk.."</p>", p, 0, 22, 800, 20, 0x010101, 0x010101, 0.7f)
- nbAfk = nbAfk + 1
- if nbAfk == nbPreAfk then
- if nbAfk == 1 then
- message = message.."<J>"..p.."<N> est AFK."
- else
- message = message.."<N>et <J>"..p.."<N> sont AFK."
- end
- else
- message = message.."<J>"..p.."<N>, "
- end
- end
- end
- for p,v in pairs(afk) do
- if not v and nbAfk > 0 then
- ui.addTextArea(nbNonAfk, "<p align='center'>"..message.."</p>", p, 0, 22, 800, 20, 0x010101, 0x010101, 0.7f)
- nbNonAfk = nbNonAfk + 1
- end
- end
- end
- function spawnBubble()
- local id
- id = tfm.exec.addShamanObject(59, math.random(30, 770), 400, 0, 0, 0, false)
- table.insert(bubbles, id)
- end
- function newGame()
- local map = tfm.get.room.currentMap
- if map == "@4537632" then -- Map neige
- tfm.exec.snow()
- end
- if #maps > 1 then
- while map == tfm.get.room.currentMap do
- map = maps[math.random(#maps)]
- end
- else
- map = maps[math.random(#maps)]
- end
- tfm.exec.newGame(map)
- if map == "@4537632" then -- Map neige
- tfm.exec.snow()
- end
- end
- function bestPlayer()
- local topScore = 16
- local bestPlayer = "-"
- for name,player in pairs(tfm.get.room.playerList) do
- if player.score >= topScore then
- topScore = player.score
- bestPlayer = name
- end
- end
- return bestPlayer
- end
- for name,player in pairs(tfm.get.room.playerList) do
- tfm.exec.setPlayerScore(name, 0, false)
- afk[name] = false
- end
- newGame()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement