Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bootcampMaps = {209848, 213755, 204488, 182769, 191203, 191177, 172520, 172520, 172621, 162482}
- local racingMaps = {5650348, 5650343, 3575034, 349984, 1661852, 4323335, 4645670, 4468155, 330590, 4174320}
- local miniGame
- ui.addTextArea(1, "<a href='event:click'>Comandos</a>", nil, 0, 380, 0, 0, 0x1C3C41, 0, 1, true)
- function eventTextAreaCallback(id, name, event)
- if event == "click" then
- 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)
- end
- end
- function eventChatCommand (name, command)
- tfm.exec.disableAutoShaman(true)
- if command == "racing" then
- miniGame = command
- playRacing()
- else if command == "bootcamp" then
- miniGame = command
- playBootcamp()
- else if command == "exit" then
- system.exit()
- else if command == "next" then
- if miniGame == "bootcamp" then
- playBootcamp()
- else if miniGame == "racing" then
- playRacing()
- end
- end
- end
- end
- end
- end
- end
- function playRacing()
- local newMap
- repeat
- newMap = math.random(#racingMaps)
- until newMap ~= currentMap
- currentMap = newMap
- tfm.exec.newGame(racingMaps[newMap])
- tfm.exec.setGameTime (60)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoTimeLeft()
- end
- function playBootcamp()
- local newMap
- repeat
- newMap = math.random(#bootcampMaps)
- until newMap ~= currentMap
- currentMap = newMap
- tfm.exec.newGame(bootcampMaps[newMap])
- tfm.exec.setGameTime (300)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAfkDeath()
- tfm.exec.disableAutoTimeLeft()
- end
- function eventNewGame()
- playersAlive = 0
- for _ in pairs(tfm.get.room.playerList) do
- playersAlive = playersAlive + 1
- end
- end
- function eventPlayerDied (name)
- if miniGame == "bootcamp" then
- tfm.exec.respawnPlayer (name)
- else if miniGame == "racing" then
- playersAlive = playersAlive - 1
- checkPlayers()
- end
- end
- end
- function eventPlayerWon (name)
- if miniGame == "bootcamp" then
- tfm.exec.respawnPlayer (name)
- else if miniGame == "racing" then
- playersAlive = playersAlive - 1
- checkPlayers()
- end
- end
- end
- function checkPlayers()
- if playersAlive == 0 then
- playRacing()
- end
- end
- function eventNewPlayer (name)
- if miniGame == "bootcamp" then
- tfm.exec.respawnPlayer (name)
- end
- end
- function eventLoop(t, tr)
- if tr <= 0 and miniGame == "racing" then
- playRacing()
- else if tr <= 0 and miniGame == "bootcamp" then
- playBootcamp()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement