Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tfm.exec.disableAutoShaman()
- tfm.exec.disableAutoTimeLeft()
- tfm.exec.disablePhysicalConsumables()
- tfm.exec.disableAutoScore()
- tfm.exec.disableAutoNewGame()
- tfm.exec.disableMortCommand()
- tfm.exec.disableAfkDeath()
- tfm.exec.newGame(7805440)
- tfm.exec.setGameTime(20)
- local playerInfo = {}
- local started = true -- x ahora siempre empieza true
- for playerName in pairs(tfm.get.room.playerList) do
- tfm.exec.freezePlayer(playerName)
- playerInfo[playerName] = {infoTimes = {countTimes = 0, average = 0.0, times = {}}}
- end
- sortTimes = function(times)
- table.sort(times, function(i, v) return i < v end)
- end
- averageTimes = function(times, name)
- local average = 0.0
- for _, time in pairs (times) do
- average = average + time
- end
- average = average / playerInfo[name].infoTimes.countTimes
- return average
- end
- stadistics = function()
- started = false
- tfm.exec.newGame(7866482)
- local averageText = "Promedio: \n"
- local bestTimeText = "Mejor tiempo: \n"
- for name in pairs(playerInfo) do
- local times = playerInfo[name].infoTimes.times
- -- Ordeno los tiempos de cada jugador
- sortTimes(times)
- bestTimeText = bestTimeText .. name .. ": " .. playerInfo[name].infoTimes.times[1] .. "\n"
- -- Saco el promedio
- playerInfo[name].infoTimes.average = averageTimes(times, name)
- print(playerInfo[name].infoTimes.average)
- averageText = averageText .. name .. ": " .. playerInfo[name].infoTimes.average .. "\n"
- end
- ui.addTextArea(14, "<p align='center'><font size='14'><V>" .. averageText .. "<V></font>", nil, 50, 50, 300, 300, 0x3C5064, 0x2D3C4B, 1, true)
- ui.addTextArea(15, "<p align='center'><font size='14'><V>" .. bestTimeText .. "<V></font>", nil, 450, 50, 300, 300, 0x3C5064, 0x2D3C4B, 1, true)
- -- print(name)
- -- print(playerInfo[name].infoTimes.times[1])
- -- print(playerInfo[name].infoTimes.times[2])
- -- print(".......")
- end
- eventLoop = function(elapsedTime, remainingTime)
- if remainingTime <= 500 and started then
- stadistics()
- end
- end
- eventPlayerWon = function(playerName, tiempoInicio, tiempoRespawn)
- tfm.exec.respawnPlayer(playerName)
- tfm.exec.freezePlayer(playerName)
- playerInfo[playerName].infoTimes.times[playerInfo[playerName].infoTimes.countTimes] = tiempoRespawn / 100
- playerInfo[playerName].infoTimes.countTimes = playerInfo[playerName].infoTimes.countTimes + 1
- end
- eventPlayerDied = function(playerName)
- tfm.exec.respawnPlayer(playerName)
- tfm.exec.freezePlayer(playerName)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement