Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- maps = {5124098, 5124067, 5124047, 5124024, 5124011, 5124002}
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoScore(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.newGame(7107555, nil)
- for i, v in pairs(tfm.get.room.playerList) do
- tfm.exec.setPlayerScore(i, 0, false)
- end
- admin = ""
- playing = false
- ui.addTextArea(1, " !nick para escolher o admin", nil, 0, 20, 800, 0, 0x123450, 0x123450, 0.9, true)
- people = 0
- function eventChatCommand(jogador, comando)
- if admin == "" then
- have = false
- for i, v in pairs(tfm.get.room.playerList) do
- if i == comando then
- have = true
- end
- end
- if have then
- admin = comando
- ui.removeTextArea(1, nil)
- ui.addTextArea(1, '<a href="event:organize">Organizar torneio</a>', admin, 0, 20, 0, 0, 0x123450, 0x123450, 1, true)
- else
- ui.updateTextArea(1, "o jogador " .. comando .. " não existe", nil)
- end
- else
- end
- end
- function eventTextAreaCallback(id, jogador, callback)
- if callback == "organize" then
- people = ""
- for i, v in pairs(tfm.get.room.playerList) do
- people = people .. '<a href="event:h'..i..'">'..i..'</a><br/>'
- end
- play = {}
- ui.addTextArea(1, 'ratos<br/>' .. people, admin, 0, 20, 400, 300, 0x123450, 0xCFCFCF, 1, true)
- ui.addTextArea(2, 'a jogar', admin, 400, 20, 400, 300, 0x123450, 0xCFCFCF, 1, true)
- ui.addTextArea(3, ' necessita no mínimo 2', admin, 0, 312, 800, 0, 0x123450, 0xCFCFCF, 1, true)
- ui.addTextArea(4, ' <a href="event:close">fechar</a>', admin, 0, 340, 800, 0, 0x123450, 0xCFCFCF, 1, true)
- end
- print(string.sub(callback, 1, 1))
- if string.sub(callback, 1, 1) == "h" then
- have = false
- print(string.sub(callback, 2))
- for i, v in pairs(play) do
- if string.sub(callback, 2) == v then
- have = true
- end
- end
- if have then
- for i, v in pairs(play) do
- if string.sub(callback, 2) == v then
- number = i
- end
- end
- play[number] = nil
- else
- play[#play + 1] = string.sub(callback, 2)
- end
- redation = 'a jogar<br/>'
- for i, v in pairs(play) do
- redation = redation .. v .. '<br/>'
- end
- ui.updateTextArea(2, redation, nil)
- if #play > 1 then
- ui.updateTextArea(3, ' <a href="event:start">começar!</a>', nil)
- else
- ui.updateTextArea(3, ' necessita no mínimo 2', nil)
- end
- end
- print(callback)
- if callback == "close" then
- ui.removeTextArea(1, admin)
- ui.removeTextArea(2, admin)
- ui.removeTextArea(3, admin)
- ui.removeTextArea(4, admin)
- ui.addTextArea(1, '<a href="event:organize">Organizar torneio</a>', admin, 0, 20, 0, 0, 0x123450, 0x123450, 1, true)
- end
- if callback == "start" then
- ui.removeTextArea(1, admin)
- ui.removeTextArea(2, admin)
- ui.removeTextArea(3, admin)
- ui.removeTextArea(4, admin)
- ui.addTextArea(1, '<a href="event:organize">Organizar torneio</a>', admin, 0, 20, 0, 0, 0x123450, 0x123450, 1, true)
- map = maps[math.random(#maps)]
- people = #play
- for i, v in pairs(play) do
- end
- playing = true
- tfm.exec.newGame(map, nil)
- end
- end
- function eventNewGame()
- is = false
- for i, v in pairs(maps) do
- if v == map then
- is = true
- end
- end
- if is then
- selected = false
- for i, v in pairs(tfm.get.room.playerList) do
- for n, g in pairs(play) do
- print(g)
- print(i)
- if i == g then
- selected = true
- end
- end
- if selected == true then
- system.bindKeyboard(i, 32, false, true)
- else
- tfm.exec.killPlayer(i)
- end
- end
- people = #play
- else
- for i, v in pairs(tfm.get.room.playerList) do
- system.bindKeyboard(i, 32, false, false)
- end
- end
- end
- function eventKeyboard(j, id, p, x, y)
- if playing then
- if tfm.get.room.playerList[j].isFacingRight then
- tfm.exec.addShamanObject(17, x, y + 30, 90, 0, 0, false)
- else
- tfm.exec.addShamanObject(17, x, y + 30, -90, 0, 0, false)
- end
- end
- end
- function eventPlayerDied(j)
- people = people -1
- if people == 1 then
- winner = j
- for i, v in pairs(tfm.get.room.playerList) do
- system.bindKeyboard(i, 32, false, false)
- if not v.isDead then
- winner = i
- end
- end
- tfm.exec.newGame(7107555, nil)
- ui.addPopup(1, 0, winner .. " ganhou!", nil, 300, 200, 200, true)
- playing = false
- tfm.exec.setPlayerScore(winner, 1, true)
- end
- end
- function eventLoop()
- upper = -1
- for i, v in pairs(tfm.get.room.playerList) do
- if v.score > upper then
- upper = v.score
- end
- for i, v in pairs(tfm.get.room.playerList) do
- if v.score == upper then
- tfm.exec.setNameColor(i, 0xE9E654)
- else
- tfm.exec.setNameColor(i, 0xC2C2DA)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement