Advertisement
Guest User

Untitled

a guest
Feb 17th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.71 KB | None | 0 0
  1. local player = "Xorcist"
  2.  
  3. local mapString = [[
  4.  
  5. @149451
  6. @150664
  7. @152260
  8. @155606
  9. @155628
  10. @159932
  11.  
  12. ]]
  13.  
  14. local maps = {}
  15. for mapCode in mapString:gmatch("[^\n]+") do
  16.     maps[#maps + 1] = mapCode
  17. end
  18. assert(#maps > 0, "There are not maps in the queue!")
  19.  
  20. local currentMap = 1
  21. local canLoadMap = true
  22.  
  23. local time = {}
  24. local respawnTimer = 0
  25. local death = 0
  26.  
  27. eventNewGame = function()
  28.     canLoadMap = false
  29.     for k, v in next, tfm.get.room.playerList do
  30.         if k ~= player then
  31.             tfm.exec.killPlayer(k)
  32.         end
  33.     end
  34.  
  35.     respawnTimer = 0
  36.     death = 0
  37.  
  38.     tfm.exec.setGameTime(1e7)
  39.     local xml = tfm.get.room.xmlMapInfo or {}
  40.     ui.setMapName(string.format("<J>%s <BL>- %s   <G>|   <N>Round : <V>%s <BL>/ <V>%s", tostring(xml.author), tostring(tfm.get.room.currentMap), currentMap, #maps))
  41. end
  42.  
  43. eventLoop = function(currentTime)
  44.     if canLoadMap then
  45.         tfm.exec.newGame(maps[currentMap])
  46.     else
  47.         if respawnTimer > 0 and os.time() > respawnTimer then
  48.             respawnTimer = 0
  49.             tfm.exec.respawnPlayer(player)
  50.         end
  51.     end
  52. end
  53.  
  54. eventPlayerWon = function(n, t)
  55.     time[currentMap] = {tfm.get.room.currentMap, t/100, death}
  56.  
  57.     if currentMap == #maps then
  58.         local maps, myTime = "", 0
  59.         for k, v in next, time do
  60.             maps = maps .. string.format("<BV>%s <BL>- <VP>%s seconds! <R>[%s deaths]\n", v[1], v[2], v[3])
  61.             myTime = myTime + v[2]
  62.         end
  63.  
  64.         ui.addTextArea(0, maps .. "\n<J>" .. myTime .. " seconds!", nil, 595, 25, 200, nil, 1, 1, .5, true)
  65.     else
  66.         currentMap = currentMap + 1
  67.         canLoadMap = true
  68.     end
  69. end
  70.  
  71. eventPlayerDied = function(n)
  72.     if n == player then
  73.         respawnTimer = os.time() + 2000
  74.         death = death + 1
  75.     end
  76. end
  77.  
  78. tfm.exec.disableAutoNewGame()
  79. tfm.exec.disableAutoShaman()
  80. tfm.exec.disableAutoScore()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement