Advertisement
mmmm123m

Untitled

Jan 25th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. owner = "Mmmm123" -- replace with your username
  2.  
  3. interval = 2
  4. cannonInfo = {}
  5. difficulty = 8
  6.  
  7. maps = {3107377,1539148,4543602,390649,495880,1463332,1492805,292678,305753,1545834,3175437,1812056,852617,799141,1794907,2939549,459284,1519483,1794873,811211,306360,489829,479091,3419948,290546,276534,3220945,1754355,281649,390657,311496,295988,802958,2643833
  8. }
  9.  
  10. function main()
  11. tfm.exec.setPlayerScore(M3lm, 75, true)
  12. tfm.exec.disableAutoNewGame(true)
  13. tfm.exec.disableAutoTimeLeft(true)
  14. tfm.exec.newGame(maps[math.random(#maps)])
  15. end
  16.  
  17. function eventNewGame()
  18. interval = 10
  19. end
  20.  
  21. function eventNewPlayer(name)
  22. end
  23.  
  24. function eventTextAreaCallback(id, name, cb)
  25. if (owner==name or owner=="nobody") and interval > 6 then
  26.  
  27. end
  28. end
  29.  
  30. function eventLoop(time, remaining)
  31. if time>3000 then
  32. interval = interval - 1
  33. if interval == difficulty then
  34. ui.removeTextArea(4)
  35. local users = {}
  36. for name,p in pairs(tfm.get.room.playerList) do
  37. if not p.isDead then
  38. users[#users+1] = name
  39. end
  40. end
  41. cannonInfo = spawnCannon(users[math.random(#users)])
  42. interval = 11
  43. elseif interval<=1 then
  44. if interval == 0 then
  45. tfm.exec.newGame(maps[math.random(#maps)])
  46. end
  47. elseif interval == 10 then
  48. tfm.exec.addShamanObject(17, cannonInfo[1], cannonInfo[2], cannonInfo[3]-90)
  49. cannonInfo={}
  50. end
  51. end
  52. if remaining<=0 then
  53. ui.addTextArea(4, "<VP><p align='center'><B>CONGRATULATIONS</B>\n\n<CH><i>you beat the CPU!", nil, 290, 22, 180, nil, 0x000001, 0xCA0805, 0.8)
  54. tfm.exec.newGame(maps[math.random(#maps)])
  55. end
  56. end
  57.  
  58. function eventPlayerDied(name)
  59. if playerCount() < 1 then
  60. interval = 6
  61. end
  62. end
  63.  
  64. function playerCount()
  65. local n=0
  66. for name, player in pairs(tfm.get.room.playerList) do
  67. if not player.isDead then
  68. n=n+1
  69. end
  70. end
  71. return n
  72. end
  73.  
  74. function spawnCannon(name)
  75. local info = {}
  76. local px = tfm.get.room.playerList[name].x
  77. local py = tfm.get.room.playerList[name].y
  78. local cnnx = math.random()*800
  79. local cnny = math.random()*400
  80. if cnny > py then
  81. cnny = py-math.random(50)-20
  82. end
  83. if math.abs(cnnx-px) > 300 then
  84. cnnx = px + math.random(-50, 50)
  85. end
  86. local ang = math.deg(math.atan2(cnny-py, cnnx-px))
  87. tfm.exec.addShamanObject(0, cnnx, cnny, ang+90)
  88. info[1] = cnnx
  89. info[2] = cnny
  90. info[3] = ang
  91. return info
  92. end
  93.  
  94. for name in pairs(tfm.get.room.playerList) do
  95. eventNewPlayer(name)
  96. end
  97.  
  98. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement