Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Creator: Bolodefchoco
- --Made in: 18/10/2015
- --Last update: 17/05/2016
- --[[ Notes:
- Does:
- Uma rotação automática usando a função rotate_maps
- Args:
- m --> Tabela de Mapas.
- o --> Tabela de Configurações:
- disableSha --> Caso true, desativará o shaman.
- disableAfk --> Caso true, desativará o AfkDeath.
- time --> Seleciona o tempo de cada mapa (em minutos).
- SCheese --> Caso true, todos começarão com queijo.
- SShaman --> Caso true, todos começarão como shaman.
- SVamp --> Caso true, todos começarão como vampiro.
- SRev --> Caso true, todos aqueles que morrerem durante a partida irão reviver.
- ]]--
- math.randomseed(os.time())
- event={}addEventListener=function(a,b)a=a:lower()event[a]=event[a]or{}local c=0;for d in next,event[a]do c=c+1 end;event[a]["e"..c+1]=b;return"e"..c+1 end;do for e,f in next,{"NewGame","PlayerDied","Loop"}do _G["event"..f]=function(...)for g,h in next,event[f:lower()]or{}do h(...)end end end end
- rotate_maps=function(m,o)
- local currentMap=""
- tfm.exec.disableAutoNewGame()
- if o.disableSha then tfm.exec.disableAutoShaman() end
- if o.disableAfk then tfm.exec.disableAfkDeath() end
- addEventListener("NewGame",function()
- currentMap=tfm.get.room.currentMap
- if o.time then tfm.exec.setGameTime(o.time*60) end
- if o.SCheese then table.foreach(tfm.get.room.playerList,tfm.exec.giveCheese) end
- if o.SShaman then table.foreach(tfm.get.room.playerList,tfm.exec.setShaman) end
- if o.SVamp then table.foreach(tfm.get.room.playerList,tfm.exec.setVampirePlayer) end
- end)
- addEventListener("PlayerDied",function()
- if o.SRev then table.foreach(tfm.get.room.playerList,tfm.exec.respawnPlayer) end
- end)
- addEventListener("Loop",function(_,r)
- local maps=m[math.random(#m)]
- local i=0
- for k,v in next,tfm.get.room.playerList do if not v.isDead then i=i+1 end end
- if i==0 or r<=0 or currentMap~=tfm.get.room.currentMap then tfm.exec.newGame(maps~=currentMap and maps or m[math.random(#m)]) end
- end)
- tfm.exec.newGame(m[math.random(#m)])
- end
- rotate_maps({1,2,3,4,5,6},{
- disableSha=false,
- disableAfk=true,
- time=2.5,
- SCheese=false,
- SShaman=false,
- SVamp=false,
- SRev=true,
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement