Brenower

[TFM][Brenower] Ballua

Jan 14th, 2014
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.40 KB | None | 0 0
  1. -- Mousellon
  2. -- Créditos:Brenower
  3. -- Tables
  4. data={};
  5. maps={"0","4560949","@4701122","@4701807","@4701827","@4701807"};
  6. lang={
  7.     BR={
  8.     ["dr"]="R";
  9.     };
  10.     INT={
  11.     ["dr"]="R";
  12.     };
  13. };
  14. mg={
  15.     ["cmm"]="BR";
  16.     ["s"]=10;
  17.     ["b"]=0;
  18. };
  19. -- Inicio do script
  20. tfm.exec.disableAutoNewGame(true)
  21. tfm.exec.disableAutoShaman(true)
  22. tfm.exec.disableAutoTimeLeft(true)
  23. tfm.exec.newGame(maps[math.random(#maps)])
  24. ui.addTextArea(1,"<TI><p align='center'><J>Ballua</p><font size='12'><N><br />Bem vindo ao mini game Ballua!<br /><br /><VP>Objetivo : <N>Chegar a toca com o queijo.<br /><br /><VP>Como jogar : <N>Pressione a tecla Space(Espaço) ou a seta de baixo para virar um balão, caso você seja um você pode apertar a tecla novamente e ir para onde o balão está.<br /><br /><N2>Pronto para jogar?",NIL,275,100,250,200,1,1,0.8,true)
  25. ui.addTextArea(2,"<p align='center'><a href='event:closeh'><b>X</b></a></p>",player,275,73,15,15,1,1,0.8,true)
  26. for i in pairs(tfm.get.room.playerList) do
  27. mg.s=mg.s+1;
  28. nD={
  29.     ["id"]=id;
  30.     ["c"]=false;
  31.     ["win"]=false;
  32.     ["time"]=os.time();
  33.     ["i"]=false;
  34.     ["t"]=0;
  35. };
  36. data[i] = nD;
  37. data[i].t = mg.s;
  38. id=tfm.exec.addShamanObject(1,3000,3000)
  39. data[i].id = id
  40. tfm.exec.bindKeyboard(i,32,false,true)
  41. tfm.exec.bindKeyboard(i,40,false,true)
  42. end
  43. -- Eventos do teclado
  44. function eventKeyboard(player,key,down,x,y)
  45.  if y >= 0 and y <= 400 and x >= 0 and x <= 800 and data[player].win == false and data[player].time < os.time()-1800 then
  46.   if tfm.get.room.playerList[player].isDead then
  47.         tfm.exec.respawnPlayer(player)
  48.         tfm.exec.movePlayer(player,tfm.get.room.objectList[data[player].id].x,tfm.get.room.objectList[data[player].id].y,false,0,0,false)
  49.         data[player].i=false;
  50.         ui.removeTextArea(data[player].t,NIL)
  51.     if data[player].c == true then
  52.         tfm.exec.giveCheese(player)
  53.     end
  54.  end
  55.   if not tfm.get.room.playerList[player].isDead then
  56.     data[player].i=true;
  57.     data[player].time=os.time();
  58.     mg.b=mg.b+1;
  59.     tfm.exec.displayParticle(26,tfm.get.room.playerList[player].x,tfm.get.room.playerList[player].y,0,0,0,0,NIL)
  60.     id=tfm.exec.addShamanObject(28,x,y,0,0,0,true)
  61.     tfm.exec.removeObject(data[player].id)
  62.     data[player].id = id;
  63.     tfm.exec.killPlayer(player)
  64.   end
  65.  end
  66. end
  67. -- Jogador pega o queijo
  68. function eventPlayerGetCheese(player)
  69.  data[player].c = true;
  70. end
  71. -- Jogador ganha a partida
  72. function eventPlayerWon(player)
  73.  data[player].win = true;
  74. end
  75. -- Novo jogo
  76. function eventNewGame()
  77.  mg.b=0;
  78.  tfm.exec.setGameTime(63)
  79.  for i in pairs(tfm.get.room.playerList) do
  80.     data[i].c = false;
  81.     data[i].win = false;
  82.     data[i].i = false;
  83.     tfm.exec.killPlayer(i)
  84.     tfm.exec.respawnPlayer(i)
  85.     ui.removeTextArea(data[i].t,NIL)
  86.     id=tfm.exec.addShamanObject(1,3000,3000)
  87.     data[i].id=id;
  88.  end
  89. end
  90. -- Loop
  91. function eventLoop(ct,rt)
  92.  tfm.exec.setUIMapName("<BL>"..tfm.get.room.currentMap.." - <N>Balões criados : <V>"..mg.b.."")
  93.  if rt <= 0 then
  94.     tfm.exec.newGame(maps[math.random(#maps)])
  95.  end
  96.  for i in pairs(tfm.get.room.playerList) do
  97.     if data[i].i == true then
  98.         ui.addTextArea(data[i].t,""..i.."",NIL,tfm.get.room.objectList[data[i].id].x-25,tfm.get.room.objectList[data[i].id].y-35,NIL,NIL,1,1,0.3)
  99.         tfm.exec.displayParticle(2,tfm.get.room.objectList[data[i].id].x,tfm.get.room.objectList[data[i].id].y,0,0,0,0,i)
  100.         tfm.exec.displayParticle(1,tfm.get.room.objectList[data[i].id].x,tfm.get.room.objectList[data[i].id].y+7,0,0,0,0,i)
  101.         tfm.exec.displayParticle(13,tfm.get.room.objectList[data[i].id].x,tfm.get.room.objectList[data[i].id].y+14,0,0,0,0,i)
  102.     end
  103.  end
  104. end
  105. -- Jogador morre
  106. function eventPlayerDied(player)
  107.  ui.addTextArea(0,"<p align='center'><R><a href='event:r'>"..lang[mg.cmm].dr.."</a></p>",player,5,20,20,20,1,1,0.7)
  108. end
  109. -- Callbacks
  110. function eventTextAreaCallback(id,player,link)
  111.  if link == [[r]] then
  112.     ui.removeTextArea(data[player].t,NIL)
  113.     data[player].i=false;
  114.     data[player].c = false;
  115.     tfm.exec.respawnPlayer(player)
  116.     ui.removeTextArea(0,player)
  117.  end
  118.  if link == [[closeh]] then
  119.     ui.removeTextArea(1,player)
  120.     ui.removeTextArea(2,player)
  121.  end
  122. end
  123. -- Novo jogador entra na sala
  124. function eventNewPlayer(player)
  125.  if not data[player] then
  126.     mg.s=mg.s+1;
  127.     nD={
  128.         ["id"]=id;
  129.         ["c"]=false;
  130.         ["win"]=false;
  131.         ["time"]=os.time();
  132.         ["i"]=false;
  133.         ["t"]=0;
  134.     };
  135.     data[player] = nD;
  136.     data[player].t = mg.s;
  137.  end
  138.  id=tfm.exec.addShamanObject(1,3000,3000)
  139.  data[player].id = id
  140.  tfm.exec.bindKeyboard(player,32,false,true)
  141.  tfm.exec.bindKeyboard(player,40,false,true)
  142. end
Advertisement
Add Comment
Please, Sign In to add comment