Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data={}
- maps={7162824,7233571}
- freezer=""
- tfm.exec.disableAutoShaman()
- tfm.exec.disableAutoNewGame()
- function eventKeyboard(name,key,down,x,y)
- if key == 32 and name == freezer and data[name].cooldown < os.time()-2000 then
- local m = 0
- table.foreach(tfm.get.room.playerList,function(k,player)
- if m == 0 and name ~= k and x >= player.x - 15 and x <= player.x + 15 and y >= player.y - 15 and y <= player.y + 15 then
- tfm.exec.killPlayer(k)
- data[k].id=tfm.exec.addImage("15eda796ea2.png","!"..player.id,0,0)
- data[k].freezed=true
- data[k].cooldown_dead = 20
- data[name].cooldown=os.time()
- m=1
- end
- end)
- end
- if key == 32 and name ~= freezer and not tfm.get.room.playerList[name].isDead and data[name].cooldown < os.time()-1000 then
- table.foreach(tfm.get.room.playerList,function(k,player)
- if data[k].cooldown_dead > 0 and name ~= k and data[k].freezed and not data[name].freezed and x >= player.x - 15 and x <= player.x + 15 and y >= player.y - 15 and y <= player.y + 15 then
- tfm.exec.respawnPlayer(k)
- tfm.exec.movePlayer(k,player.x,player.y)
- tfm.exec.removeImage(data[k].id)
- data[k].freezed=false
- ui.removeTextArea(player.id)
- data[name].cooldown=os.time()
- end
- end)
- end
- end
- function eventNewGame()
- freezer=""
- table.foreach(tfm.get.room.playerList,function(k,v)
- ui.removeTextArea(v.id,nil)
- tfm.exec.removeImage(data[k].id)
- data[k].cooldown_dead=0
- end)
- end
- function check()
- table.foreach(tfm.get.room.playerList,function(k,v)
- if v.isDead then
- if data[k].cooldown_dead > 0 then
- ui.addTextArea(v.id,'<B><font color="#2F7FCC" size="13">'..math.floor(data[k].cooldown_dead/2),nil,v.x,v.y,30,30,0,0,0,true)
- data[k].cooldown_dead=data[k].cooldown_dead-1
- else
- ui.removeTextArea(v.id)
- v.isDead=false
- end
- end
- end)
- end
- function eventLoop(t,r)
- if t > 4000 then
- if freezer == "" then
- local p = {} table.foreach(tfm.get.room.playerList,function(k,v) tfm.exec.setNameColor(k,0) table.insert(p,k) end)
- freezer = p[math.random(#p)]
- tfm.exec.setNameColor(freezer,0xFFCC00)
- data[freezer].cooldown=os.time();
- end
- if tfm.get.room.playerList[freezer].isDead then
- for name,v in pairs(tfm.get.room.playerList) do if not v.isDead then tfm.exec.giveCheese(name)tfm.exec.playerVictory(name) end end
- tfm.exec.chatMessage("<FC>O freezer "..freezer.." morreu, os ratos vivos ganharam.</FC>")
- tfm.exec.newGame(maps[math.random(#maps)])
- end
- if r <= 1000 then
- tfm.exec.chatMessage("<FC>O tempo acabou.</FC>")
- tfm.exec.newGame(maps[math.random(#maps)])
- end
- check()
- end
- end
- function eventNewPlayer(name)
- data[name]={
- id=nil,
- freezed=false,
- cooldown=0,
- cooldown_dead=0
- }
- system.bindKeyboard(name,32,true)
- end
- table.foreach(tfm.get.room.playerList,eventNewPlayer)
- tfm.exec.newGame(maps[math.random(#maps)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement