Advertisement
Dudugz-Contistente

Untitled

Sep 21st, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. config=[[
  2. Fast Racing <BL>|</BL> <BL>%s</BL>
  3. #7 #17
  4. 60
  5. 5
  6. ]]
  7.  
  8. tfm.exec.disableAutoNewGame()
  9.  
  10. read={
  11. lines=function(string)
  12. local lines={}
  13. for line in string.gmatch(string,'(.-)%\n') do
  14. table.insert(lines,line)
  15. end
  16.  
  17. return lines
  18. end,
  19. }
  20.  
  21. get={
  22. alives=function()
  23. local a = 0
  24. table.foreach(tfm.get.room.playerList,function(k,v) if not v.isDead then a=a+1 end end)
  25. return a
  26. end,
  27. }
  28.  
  29. function split(t,s)
  30. local a={}
  31. for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
  32. table.insert(a,i)
  33. end
  34. return a
  35. end
  36.  
  37.  
  38. function toboolean(int)
  39. if int == 2 or int == 0 then
  40. return false
  41. elseif int == 1 then
  42. return true
  43. end
  44. end
  45.  
  46. function newMap()
  47. tfm.exec.newGame(split(read.lines(config)[2]," ")[math.random(#split(read.lines(config)[2]," "))],toboolean(math.random(1,2)))
  48. tfm.exec.setGameTime(read.lines(config)[3])
  49.  
  50. local code = tfm.get.room.currentMap
  51.  
  52. if code == "0" then
  53. code = "Nil"
  54. end
  55.  
  56. ui.setMapName(string.format(read.lines(config)[1],code))
  57. end
  58.  
  59. function eventPlayerWon(name)
  60. tfm.exec.setGameTime(read.lines(config)[4])
  61. end
  62.  
  63. function eventLoop(t,r)
  64. if get.alives() == 0 or r <= 1000 then
  65. newMap()
  66. end
  67. end
  68.  
  69. newMap()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement