Advertisement
Guest User

Jogo do balão!

a guest
Dec 26th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. local maps = {521255,4387463,401434,4029628,679132,906121,993789,3346025,2143505,944010,3929757,4057745,3999304,4011106,3873429,3984472,4059199,4059533,4062197,2618050,1233889,2829765,4456202,99,4098580,4061028,4078520,
  2. 4151007,4264271,4011785,3806606,3216123,3,3269598}
  3.  
  4. tfm.exec.disableAutoShaman(true)
  5. print("<N>Welcome to <font color='#89A7F5'>#bubble<N>,Press space for spawn one bubble and complete the map with them, the bubbles will disappear after 5 seconds to do so easy minigame <font color='#000000'>Diviertete !")
  6. tfm.exec.disableAutoNewGame(true)
  7. tfm.exec.disableAutoShaman(true)
  8. players={}
  9. toDespawn={}
  10.  
  11. function eventNewPlayer(name)
  12. for i,key in ipairs({32,40,83}) do
  13. tfm.exec.bindKeyboard(name,key,true,true)
  14. end
  15. players[name]={
  16. timestamp=os.time(),
  17. offsets={x=2, y=10}
  18. }
  19. end
  20.  
  21. function eventKeyboard(name,key,down,x,y)
  22. if (key==32 or key==40 or key==83) and not tfm.get.room.playerList[name].isDead and started then
  23. if players[name].timestamp < os.time()-1000 then
  24. local id
  25. if tfm.get.room.playerList[name].isFacingRight then
  26. id=tfm.exec.addShamanObject(2801,x+players[name].offsets.x,y+players[name].offsets.y)
  27. else
  28. id=tfm.exec.addShamanObject(2801,x+players[name].offsets.x,y+players[name].offsets.y)
  29. end
  30. players[name].timestamp=os.time()
  31. table.insert(toDespawn,{os.time(),id})
  32. end
  33. end
  34. end
  35.  
  36. function eventChatCommand(name,command)
  37. local arg={}
  38. for argument in command:gmatch("[^%s]+") do
  39. table.insert(arg,argument)
  40. end
  41. if arg[1]=="off" then
  42. if tonumber(arg[2]) and tonumber(arg[3]) then
  43. players[name].offsets.x=tonumber(arg[2])
  44. players[name].offsets.y=tonumber(arg[3])
  45. else
  46. players[name].offsets.x=2
  47. players[name].offsets.y=10
  48. end
  49. tfm.exec.chatMessage("Offsets changed to X:"..players[name].offsets.x.." Y:"..players[name].offsets.y,name)
  50. end
  51. end
  52.  
  53. function eventNewGame()
  54. started=false
  55. end
  56.  
  57. function eventLoop(time,remaining)
  58. if time >= 3000 and not started then
  59. started=true
  60. end
  61. if remaining<=0 then
  62. tfm.exec.newGame(maps[math.random(#maps)])
  63. end
  64. for i,balloon in ipairs(toDespawn) do
  65. if balloon[1] <= os.time()-5000 then
  66. tfm.exec.removeObject(balloon[2])
  67. table.remove(toDespawn,i)
  68. end
  69. end
  70. end
  71.  
  72. function eventPlayerDied(name)
  73. local i=0
  74. local n
  75. for pname,player in pairs(tfm.get.room.playerList) do
  76. if not player.isDead then
  77. i=i+1
  78. n=pname
  79. end
  80. end
  81. if i==0 then
  82. tfm.exec.newGame(maps[math.random(#maps)])
  83. elseif i==1 then
  84. tfm.exec.giveCheese(90)
  85. tfm.exec.playerVictory(90)
  86. tfm.exec.setGameTime(10)
  87. end
  88. end
  89.  
  90. for name,player in pairs(tfm.get.room.playerList) do
  91. eventNewPlayer(name)
  92. end
  93. tfm.exec.newGame(maps[math.random(#maps)])
  94. tfm.exec.setUIMapName ("Jogo do balão!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement