Advertisement
Tectoon

[TFM] Untitled

Dec 18th, 2015
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.73 KB | None | 0 0
  1. local bootcampMaps = {209848, 213755, 204488, 182769, 191203, 191177, 172520, 172520, 172621, 162482}
  2. local racingMaps = {5650348, 5650343, 3575034, 349984, 1661852, 4323335, 4645670, 4468155, 330590, 4174320}
  3. local miniGame
  4.  
  5. ui.addTextArea(1, "<a href='event:click'>Comandos</a>", nil, 0, 380, 0, 0, 0x1C3C41, 0, 1, true)
  6.  
  7. function eventTextAreaCallback(id, name, event)
  8.         if event == "click" then
  9.         ui.addPopup (1, 0, "<font size='20'>Comandos:</font><BR>• <B>!racing</B> para iniciar la rotación P17.<BR>• <B>!bootcamp</B> para iniciar la rotación P3.<BR>• <B>!survivor</B> para iniciar la rotación P10   (proximamente).<BR>• <B>!exit</B> para desactivar el script.<BR>• <B>!next</B> para un nuevo mapa.<BR>", name, 250, 140, 300, true)
  10.     end
  11. end
  12.  
  13. function eventChatCommand (name, command)
  14.     tfm.exec.disableAutoShaman(true)
  15.     if command == "racing" then
  16.         miniGame = command
  17.         playRacing()
  18.     else if command == "bootcamp" then
  19.         miniGame = command
  20.         playBootcamp()
  21.     else if command == "exit" then
  22.         system.exit()
  23.     else if command == "next" then
  24.         if miniGame == "bootcamp" then
  25.             playBootcamp()
  26.         else if miniGame == "racing" then
  27.             playRacing()
  28.         end
  29.         end
  30.     end
  31.     end
  32.     end
  33.     end
  34. end
  35.  
  36. function playRacing()
  37.         local newMap
  38.         repeat
  39.             newMap = math.random(#racingMaps)
  40.         until newMap ~= currentMap
  41.         currentMap = newMap
  42.         tfm.exec.newGame(racingMaps[newMap])
  43.         tfm.exec.setGameTime (60)
  44.         tfm.exec.disableAutoNewGame(true)
  45.         tfm.exec.disableAutoTimeLeft()
  46. end
  47.  
  48. function playBootcamp()
  49.         local newMap
  50.         repeat
  51.             newMap = math.random(#bootcampMaps)
  52.         until newMap ~= currentMap
  53.         currentMap = newMap
  54.         tfm.exec.newGame(bootcampMaps[newMap])
  55.         tfm.exec.setGameTime (300)
  56.         tfm.exec.disableAutoNewGame(true)
  57.         tfm.exec.disableAfkDeath()
  58.         tfm.exec.disableAutoTimeLeft()
  59. end
  60.  
  61. function eventNewGame()
  62.     playersAlive = 0
  63.     for _ in pairs(tfm.get.room.playerList) do
  64.     playersAlive = playersAlive + 1
  65.     end
  66. end
  67.  
  68. function eventPlayerDied (name)
  69.         if miniGame == "bootcamp" then
  70.             tfm.exec.respawnPlayer (name)
  71.         else if miniGame == "racing" then
  72.             playersAlive = playersAlive - 1
  73.             checkPlayers()
  74.         end
  75.         end
  76. end
  77.  
  78. function eventPlayerWon (name)
  79.         if miniGame == "bootcamp" then
  80.             tfm.exec.respawnPlayer (name)
  81.         else if miniGame == "racing" then
  82.             playersAlive = playersAlive - 1
  83.             checkPlayers()
  84.         end
  85.         end
  86. end
  87.  
  88. function checkPlayers()
  89.         if playersAlive == 0 then
  90.             playRacing()
  91.         end
  92. end
  93.  
  94. function eventNewPlayer (name)
  95.         if miniGame == "bootcamp" then
  96.             tfm.exec.respawnPlayer (name)
  97.         end
  98. end
  99.  
  100. function eventLoop(t, tr)
  101.     if tr <= 0 and miniGame == "racing" then
  102.             playRacing()
  103.         else if tr <= 0 and miniGame == "bootcamp" then
  104.             playBootcamp()
  105.         end
  106.         end
  107. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement