Manacer

#Baffbotffa LUA

Nov 11th, 2013
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.66 KB | None | 0 0
  1.  
  2. -- Baffbotffa By Shamousey, Amélioration par Manacer (Temp 1,2,3,GO + Lancement de map dès que le joueur est rentrer dans le trou).
  3. -- Baffbotffa By Shamousey, Improvement By Manacer (Time 1,2,3,GO + Launch map as soon as the player has win.)
  4.  
  5. tfm.exec.disableAutoShaman(true)
  6. tfm.exec.disableAutoNewGame(true)
  7. tfm.exec.disableAutoScore(true)
  8. players={}
  9. toDespawn={}
  10. maps={521833,401421,541917,541928,541936,541943,527935,559634,559644,888052,878047,885641,770600,770656,772172,891472,589736,589800,589708,900012,901062,754380,901337,901411,907870,910078,1190467,1252043,1124380,1016258,1252299,1255902,1256808,986790,1285380,1271249,1255944,1255983,1085344,1273114,1276664,1279258,1286824,1280135,1280342,1284861,1287556,1057753,1196679,1288489,1292983,1298164,1298521,1293189,1296949,1308378,1311136,1314419,1314982,1318248,1312411,1312589,1312845,1312933,1313969,1338762,1339474,1349878,1297154,644588,1351237,1354040,1354375,1362386,1283234,1370578,1306592,1360889,1362753,1408124,1407949,1407849,1343986,1408028,1441370,1443416,1389255,1427349,1450527,1424739,869836,1459902,1392993,1426457,1542824,1533474,1561467,1563534,1566991,1587241,1416119,1596270,1601580,1525751,1582146,1558167,1420943,1466487,1642575,1648013,1646094,1393097,1643446,1545219,1583484,1613092,1627981,1633374,1633277,1633251,1585138,1624034,1616785,1625916,1667582,1666996,1675013,1675316,1531316,1665413,1681719,1699880,1688696,623770,1727243,1531329,1683915,1689533,1738601,3756146,912118,3326933,3722005,3566478,1456622,1357994,1985670,1884075,1708065,1700322,2124484,3699046,2965313,4057963,4019126,3335202,2050466}
  11.  
  12. ui.addTextArea(2, "<font size='15'>Lancement du baffbotffa dans ...</font>", all, 260, 110,nil,nil,4524564444467495757)
  13.  
  14. for all in pairs(tfm.get.room.playerList) do tfm.exec.setPlayerScore(all, 0, false)
  15. end
  16.  
  17. function eventNewPlayer(name)
  18.     for i,key in ipairs({32,40,83}) do
  19.         tfm.exec.bindKeyboard(name,key,true,true)
  20.     end
  21.     players[name]={
  22.         timestamp=os.time(),
  23.         offsets={x=2, y=10}
  24.     }
  25. end
  26.  
  27. function eventNewGame()
  28.     timer = 28
  29.     started=false
  30. end
  31.  
  32. function eventKeyboard(name,key,down,x,y)
  33.     if (key==32 or key==40 or key==83) and not tfm.get.room.playerList[name].isDead and started then
  34.         if players[name].timestamp < os.time()-1000 then
  35.             local id
  36.             if tfm.get.room.playerList[name].isFacingRight then
  37.                 id=tfm.exec.addShamanObject(19,x+players[name].offsets.x,y+players[name].offsets.y)
  38.             else
  39.                 id=tfm.exec.addShamanObject(20,x+players[name].offsets.x,y+players[name].offsets.y)
  40.             end
  41.             players[name].timestamp=os.time()
  42.             table.insert(toDespawn,{os.time(),id})
  43.         end
  44.     end
  45. end
  46.  
  47.  
  48. function eventPlayerWon(name)
  49.  tfm.exec.newGame(maps[math.random(#maps)])
  50.  tfm.exec.setPlayerScore(name, 5, true)
  51.  ui.addTextArea(2, "<font size='15'>Bravo à </font><font size='17'><J>"..name.." </font>", all, 380, 110,nil,nil)
  52. end
  53.  
  54. function eventPlayerDied(name)
  55.     local i=0
  56.     local n
  57.     for pname,player in pairs(tfm.get.room.playerList) do
  58.         if not player.isDead then
  59.             i=i+1
  60.             n=pname
  61.         end
  62.     end
  63.     if i==0 then
  64.         tfm.exec.newGame(maps[math.random(#maps)])
  65.     elseif i==1 then
  66.         tfm.exec.giveCheese(n)
  67.         tfm.exec.playerVictory(n)
  68.         tfm.exec.setGameTime(5)
  69.     end
  70. end
  71.  
  72. for name,player in pairs(tfm.get.room.playerList) do
  73.     eventNewPlayer(name)
  74. end
  75.  
  76. tfm.exec.newGame(maps[math.random(#maps)])
  77.  
  78. timer = 28
  79. function eventLoop(currentTime, timeRemaining)
  80.   timer = timer + 0.5
  81.   if timer==33 then
  82.     ui.addTextArea(2, "<font size='19'>GO</font>", all, 380, 110,nil,nil,1234564444467495757)
  83.     if timer >= 33 and not started then
  84.     started=true
  85.     end
  86.     if timeRemaining<=0 then
  87.     tfm.exec.newGame(maps[math.random(#maps)])
  88.     end
  89.     for i,cannon in ipairs(toDespawn) do
  90.         if cannon[1] <= os.time()-33 then
  91.             tfm.exec.removeObject(cannon[2])
  92.             table.remove(toDespawn,i)
  93.             end
  94.             end
  95.             end
  96.   if timer==35 then
  97.   ui.removeTextArea(2,all)
  98.   end
  99.   if timer==27 then
  100.     ui.addTextArea(2, "<font size='15'>4</font>", all, 380, 110,nil,nil)
  101.     end
  102.   if timer==28 then
  103.     ui.addTextArea(2, "<font size='15'>Lancement du baffbotffa dans ...</font>", all, 260, 110,nil,nil,4524564444467495757)
  104.     end
  105.   if timer==30 then
  106.     ui.addTextArea(2, "<font size='16'>3</font>", all, 380, 110,nil,nil,1234564444444499999)
  107.     end
  108.   if timer==31 then
  109.     ui.addTextArea(2, "<font size='17'>2</font>", all, 380, 110,nil,nil,1555456789)
  110.     end
  111.   if timer==32 then
  112.     ui.addTextArea(2, "<font size='18'>1</font>", all, 380, 110,nil,nil,1345495289)
  113.     end
  114.   if timer==999 then
  115.   ui.addTextArea(2, "", all, 380, 110,nil,nil,1234564444467495757)
  116. end
  117. end
  118.  
  119.  
  120. function eventChatCommand(name,command) -- A partir de la il y'a les commandes
  121.   if command == "start" then
  122.   timer = 27
  123.   end
  124.   end
Advertisement
Add Comment
Please, Sign In to add comment