Advertisement
Antfield

Untitled

May 13th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.53 KB | None | 0 0
  1. admin = "Antfield" -- Colocar tu nombre.
  2. cash = {}
  3. countdown = 6
  4. item = {}
  5. maps = {290361, 127401}
  6. players = {}
  7.  
  8. tfm.exec.disableAutoNewGame()
  9. tfm.exec.disableAutoShaman()
  10.  
  11. tfm.exec.newGame(maps[math.random(#maps)])
  12.  
  13. function eventNewGame()
  14. countdown = 6
  15. started = false
  16. tfm.exec.setUIMapName("<J>"..countdown.."...\n")
  17. end
  18.  
  19. function eventNewPlayer(pN)
  20. item[pN] = 0
  21. players[pN] = {timestamp = os.time()}
  22. tfm.exec.bindKeyboard(pN, 32, true, true)
  23. for n, kC in pairs({40}) do
  24. tfm.exec.bindKeyboard(pN, kC, true, true)
  25. end
  26. system.bindMouse(pN, true)
  27. if pN == admin then
  28. cash[pN] = 888888
  29. else
  30. cash[pN] = 0
  31. end
  32. ui.addTextArea(0, "You have "..cash[pN].." cash!", pN, 638, 28, 155, 20, 0x111111, 0x111111, 1, true)
  33. ui.addTextArea(1, "<a href = 'event:derollshop'>Tienda! ▼", pN, 9, 28, 100, 20, 0x111111, 0x111111, 1, true)
  34. end
  35.  
  36. function eventLoop(eT, rT)
  37. if eT >= 6000 and not started then
  38. started = true
  39. end
  40. countdown = countdown - 1
  41. tfm.exec.setUIMapName("<J>"..countdown.."...\n")
  42. if countdown <= 0 then
  43. tfm.exec.setUIMapName("<J>Fight!\n")
  44. end
  45. for pN in pairs(tfm.get.room.playerList) do
  46. cash[pN] = cash[pN] + 1
  47. ui.updateTextArea(0, "Tienes "..cash[pN].." pesos!", pN, 638, 28, 155, 20, 0x111111, 0x111111, 1, true)
  48. end
  49. end
  50.  
  51. function eventKeyboard(pN, kC, down, x, y)
  52. if kC == 32 then
  53. tfm.exec.movePlayer(pN, 0, 0, true, 0, -50, false)
  54. elseif kC == 40 and item[pN] == 0 and players[pN].timestamp < os.time() - 750 then
  55. tfm.exec.addShamanObject(17, x, y, tfm.get.room.playerList[pN].isFacingRight and 90 or 270)
  56. players[pN].timestamp = os.time()
  57. elseif kC == 40 and item[pN] == 1 and players[pN].timestamp < os.time() - 750 then
  58. tfm.exec.addShamanObject(1701, x, y, tfm.get.room.playerList[pN].isFacingRight and 90 or 270)
  59. players[pN].timestamp = os.time()
  60. elseif kC == 40 and item[pN] == 2 and players[pN].timestamp < os.time() - 750 then
  61. tfm.exec.addShamanObject(1703, x, y, tfm.get.room.playerList[pN].isFacingRight and 90 or 270)
  62. players[pN].timestamp = os.time()
  63. elseif kC == 40 and item[pN] == 3 and players[pN].timestamp < os.time() - 750 then
  64. tfm.exec.addShamanObject(1702, x, y, tfm.get.room.playerList[pN].isFacingRight and 90 or 270)
  65. players[pN].timestamp = os.time()
  66. elseif kC == 40 and item[pN] == 4 and players[pN].timestamp < os.time() - 750 then
  67. tfm.exec.addShamanObject(1704, x, y, tfm.get.room.playerList[pN].isFacingRight and 90 or 270)
  68. players[pN].timestamp = os.time()
  69. elseif kC == 40 and item[pN] == 5 and players[pN].timestamp < os.time() - 750 then
  70. tfm.exec.addShamanObject(1705, x, y, tfm.get.room.playerList[pN].isFacingRight and 90 or 270)
  71. players[pN].timestamp = os.time()
  72. elseif kC == 40 and item[pN] == 6 and players[pN].timestamp < os.time() - 750 then
  73. tfm.exec.addShamanObject(1706, x, y, tfm.get.room.playerList[pN].isFacingRight and 90 or 270)
  74. players[pN].timestamp = os.time()
  75. end
  76. end
  77.  
  78. function eventPlayerDied(pN)
  79. local aM = 0
  80. local pN2
  81. for n, p in pairs(tfm.get.room.playerList) do
  82. if not p.isDead then
  83. aM = aM + 1
  84. pN2 = n
  85. end
  86. end
  87. if aM == 1 then
  88. tfm.exec.giveCheese(pN2)
  89. tfm.exec.playerVictory(pN2)
  90. tfm.exec.setGameTime(5)
  91. tfm.exec.newGame(maps[math.random(#maps)])
  92. end
  93. end
  94.  
  95. function eventTextAreaCallback(id, pN, answer)
  96. if answer == "derollshop" then
  97. ui.addTextArea(1, "<a href = 'event:rollshop'>Tienda! ▲</a>\n-> <a href = 'event:glassed'>Cañón de vidrio - 250 coins</a>\n-> <a href = 'event:ornament'>Cañón navideño - 250 coins</a>\n-> <a href = 'event:lollipop'>Cañon de dulce - 300 coins</a>\n-> <a href = 'event:angel'>Cañon de angel - 350 coins</a>\n-> <a href = 'event:apple'>Cañon de manzana - 350 coins</a>\n-> <a href = 'event:watermelon'>Cañón de sandía - 500 coins</a>", pN, 9, 27, 205, 100, 0x111111, 0x111111, 1, true)
  98. elseif answer == "rollshop" then
  99. ui.addTextArea(1, "<a href = 'event:derollshop'>Shop! ▼", pN, 9, 28, 100, 20, 0x111111, 0x111111, 1, true)
  100. elseif answer == "glassed" then
  101. if cash[pN] >= 250 then
  102. item[pN] = 1
  103. cash[pN] = cash[pN] - 250
  104. ui.updateTextArea(0, "You have "..cash[pN].." cash!", pN, 638, 28, 155, 20, 0x111111, 0x111111, 1, true)
  105. end
  106. elseif answer == "ornament" then
  107. if cash[pN] >= 250 then
  108. item[pN] = 2
  109. cash[pN] = cash[pN] - 250
  110. ui.updateTextArea(0, "You have "..cash[pN].." cash!", pN, 638, 28, 155, 20, 0x111111, 0x111111, 1, true)
  111. end
  112. elseif answer == "lollipop" then
  113. if cash[pN] >= 300 then
  114. item[pN] = 3
  115. cash[pN] = cash[pN] - 300
  116. ui.updateTextArea(0, "You have "..cash[pN].." cash!", pN, 638, 28, 155, 20, 0x111111, 0x111111, 1, true)
  117. end
  118. elseif answer == "angel" then
  119. if cash[pN] >= 350 then
  120. item[pN] = 4
  121. cash[pN] = cash[pN] - 350
  122. ui.updateTextArea(0, "You have "..cash[pN].." cash!", pN, 638, 28, 155, 20, 0x111111, 0x111111, 1, true)
  123. end
  124. elseif answer == "apple" then
  125. if cash[pN] >= 350 then
  126. item[pN] = 5
  127. cash[pN] = cash[pN] - 350
  128. ui.updateTextArea(0, "You have "..cash[pN].." cash!", pN, 638, 28, 155, 20, 0x111111, 0x111111, 1, true)
  129. end
  130. elseif answer == "watermelon" then
  131. if cash[pN] >= 500 then
  132. item[pN] = 6
  133. cash[pN] = cash[pN] - 500
  134. ui.updateTextArea(0, "You have "..cash[pN].." cash!", pN, 638, 28, 155, 20, 0x111111, 0x111111, 1, true)
  135. end
  136. end
  137. end
  138.  
  139. for pN in pairs(tfm.get.room.playerList) do
  140. eventNewPlayer(pN)
  141. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement