Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OBS: Ainda é preciso por uma rotação para por os mapas! ou seja a script ainda esta incompleta.
- ---------------------------------------------------------------------------------------------------------------------------------
- data = {games=0}
- topBar = {
- pos = {
- fg = "<font color='#336600'><b>First</b>: %s</font>",
- bg = "<font color='#FFFFFF'><b>First</b>: %s</font>",
- },
- neg = {
- fg = "<font color='#CC0000'><b>First</b>: %s</font>",
- bg = "<font color='#FFFFFF'><b>First</b>: %s</font>",
- }
- }
- statsMgr = {
- update = function(name)
- x, y = 0, 25
- if data[name].First >= 0 then
- ui.addTextArea(1, string.format(topBar.pos.fg, data[name].First), name, x, y-1, 900, 25, nil, nil, 0, true)
- ui.addTextArea(2, string.format(topBar.pos.fg, data[name].First), name, x, y+1, 900, 25, nil, nil, 0, true)
- ui.addTextArea(3, string.format(topBar.pos.fg, data[name].First), name, x+1, y, 900, 25, nil, nil, 0, true)
- ui.addTextArea(4, string.format(topBar.pos.fg, data[name].First), name, x-1, y, 900, 25, nil, nil, 0, true)
- ui.addTextArea(5, string.format(topBar.pos.bg, data[name].First), name, x, y, 900, 25, nil, nil, 0, true)
- else
- ui.addTextArea(1, string.format(topBar.neg.fg, data[name].First), name, x, y-1, 900, 25, nil, nil, 0, true)
- ui.addTextArea(2, string.format(topBar.neg.fg, data[name].First), name, x, y+1, 900, 25, nil, nil, 0, true)
- ui.addTextArea(3, string.format(topBar.neg.fg, data[name].First), name, x+1, y, 900, 25, nil, nil, 0, true)
- ui.addTextArea(4, string.format(topBar.neg.fg, data[name].First), name, x-1, y, 900, 25, nil, nil, 0, true)
- ui.addTextArea(5, string.format(topBar.neg.bg, data[name].First), name, x, y, 900, 25, nil, nil, 0, true)
- end
- tfm.exec.setPlayerScore(name, data[name].stats, true)
- end
- }
- function main()
- for k,v in pairs(tfm.get.room.playerList) do
- eventNewPlayer(k)
- tfm.exec.setPlayerScore(k, 0, true)
- tfm.exec.newGame("#7")
- end
- end
- function eventLoop(time, remainingtime)
- if tfm.get.room.alive() == 0 and remainingtime <= 0 then
- local currentMap = "#7"
- tfm.exec.newGame(currentMap)
- end
- end
- function eventNewGame()
- data.games = data.games + 1
- if tfm.get.room.xmlMapInf then
- mapcode = tfm.get.room.xmlMapInfo.mapCode or "0"
- else
- mapcode = "0, 5"
- end
- end
- function eventNewPlayer(name)
- tbl = {First=0,stats=0}
- data[name] = tbl
- statsMgr.update(name)
- end
- function eventPlayerWon(name)
- if tfm.get.room.alive() == 0 then
- local currentMap = maps[math.random(#maps)]
- tfm.exec.newGame(currentMap)
- end
- data[name].First = data[name].First + 1
- data[name].stats = data[name].stats + 1
- statsMgr.update(name)
- end
- function eventPlayerDied(name)
- data[name].First = data[name].First - 1
- data[name].stats = data[name].stats - 1
- statsMgr.update(name)
- if tfm.get.room.alive() == 0 then
- local currentMap = '#7'
- tfm.exec.newGame(currentMap)
- end
- end
- function eventPlayerGotCheese(name)
- data[name].First = data[name].First + 0.5
- statsMgr.update(name)
- end
- function tfm.get.room.alive()
- local alivePlayers={}
- for name,player in pairs(tfm.get.room.playerList) do
- if not player.isDead then
- table.insert(alivePlayers, name)
- end
- end
- return alivePlayers
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment