Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- config=[[
- Fast Racing <BL>|</BL> <BL>%s</BL>
- #7 #17
- 60
- 5
- ]]
- tfm.exec.disableAutoNewGame()
- read={
- lines=function(string)
- local lines={}
- for line in string.gmatch(string,'(.-)%\n') do
- table.insert(lines,line)
- end
- return lines
- end,
- }
- get={
- alives=function()
- local a = 0
- table.foreach(tfm.get.room.playerList,function(k,v) if not v.isDead then a=a+1 end end)
- return a
- end,
- }
- function split(t,s)
- local a={}
- for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
- table.insert(a,i)
- end
- return a
- end
- function toboolean(int)
- if int == 2 or int == 0 then
- return false
- elseif int == 1 then
- return true
- end
- end
- function newMap()
- tfm.exec.newGame(split(read.lines(config)[2]," ")[math.random(#split(read.lines(config)[2]," "))],toboolean(math.random(1,2)))
- tfm.exec.setGameTime(read.lines(config)[3])
- local code = tfm.get.room.currentMap
- if code == "0" then
- code = "Nil"
- end
- ui.setMapName(string.format(read.lines(config)[1],code))
- end
- function eventPlayerWon(name)
- tfm.exec.setGameTime(read.lines(config)[4])
- end
- function eventLoop(t,r)
- if get.alives() == 0 or r <= 1000 then
- newMap()
- end
- end
- newMap()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement