Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- table.random = function(tbl)
- return tbl[math.random(#tbl)]
- end
- local getRandomPlayer = function()
- local players = { }
- for k, v in next, tfm.get.room.playerList do
- if not v.isDead then
- players[#players + 1] = k
- end
- end
- return table.random(players)
- end
- local target_timer, target = os.time()
- eventNewGame = function()
- if tfm.get.room.uniquePlayers == 1 then
- tfm.exec.chatMessage("<ROSE>This game needs at least two players.")
- return
- end
- if target then
- system.bindKeyboard(target, 32, true, false)
- end
- target = getRandomPlayer()
- ui.setShamanName(target)
- system.bindKeyboard(target, 32, true, true)
- end
- local balls = { "165220ae31c.png", "165220afb1a.png", "165220b1300.png", "165220b2adc.png", "165220b429a.png" }
- local objects = { }
- local getRandomObject = function()
- local o = table.random(objects)
- return o and tfm.get.room.objectList[o[1]]
- end
- eventKeyboard = function(playerName, key, d, x, y)
- if playerName == target then
- if os.time() > target_timer then
- target_timer = os.time() + 1000
- if not tfm.get.room.playerList[playerName].isDead then
- tfm.exec.killPlayer(playerName)
- for i = 1, 6 do
- objects[i] = {
- [1] = tfm.exec.addShamanObject(6, x + math.random(-5, 5), y, math.random(360))
- }
- objects[i][2] = tfm.exec.addImage(table.random(balls), "#" .. objects[i][1], -15, -15)
- end
- else
- local obj = getRandomObject()
- if obj then
- local x, y = obj.x, obj.y
- for i = 1, 6 do
- tfm.exec.removeImage(objects[i][2])
- tfm.exec.removeObject(objects[i][1])
- end
- objects = { }
- tfm.exec.respawnPlayer(playerName)
- tfm.exec.movePlayer(playerName, x, y)
- end
- end
- end
- end
- end
- eventLoop = function(current, remaining, ignore)
- if ignore or remaining <= 500 then
- tfm.exec.newGame("#7")
- end
- end
- eventNewPlayer = function()
- if tfm.get.room.uniquePlayers == 2 then
- eventLoop(nil, nil, true)
- end
- end
- eventLoop(nil, nil, true)
- tfm.exec.disableAutoNewGame()
- tfm.exec.disableAutoTimeLeft()
- tfm.exec.disableAutoShaman()
Advertisement
Add Comment
Please, Sign In to add comment