Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p={}
- mapas = {0}
- time = os.time();
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoNewGame(true)
- function split(t,s)
- local a={}
- for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
- table.insert(a,i)
- end
- return a
- end
- function eventNewGame()
- passar = os.time();
- vivos = 0
- tfm.exec.setGameTime(9999)
- for i in pairs(tfm.get.room.playerList) do
- p[i].life = 100
- ui.addTextArea(1,"",i,6,30,math.floor(p[i].life*2),16,0x00EE00,0x00CD00,70,true)
- ui.addTextArea(2,"<p align='center'><R>"..p[i].life.."/100",i,6,30,200,16,0,0,0,true)
- tfm.exec.setPlayerScore(i,p[i].life,false)
- vivos = vivos+1;
- end
- end
- function eventNewPlayer(name)
- p[name]={
- life = 100,
- tempo = os.time(),
- }
- tfm.exec.bindKeyboard(name,32,true)
- tfm.exec.setPlayerScore(name,p[name].life,false)
- ui.addTextArea(0,"",name,6,30,200,16,0x00CD00,0x00CD00,90,true)
- ui.addTextArea(1,"",name,6,30,math.floor(p[name].life*2),16,0x00EE00,0x00CD00,70,true)
- ui.addTextArea(2,"<p align='center'><R>"..p[name].life.."/100",name,6,30,200,16,0,0,0,true)
- end
- for all in pairs(tfm.get.room.playerList) do
- eventNewPlayer(all)
- end
- function eventKeyboard(name, key, down, x, y)
- if key == 32 and p[name].tempo < os.time()-800 then
- for n,player in pairs(tfm.get.room.playerList) do
- if n ~= name and x >= player.x - 25 and x <= player.x + 25 and y >= player.y - 25 and y <= player.y + 25 and not tfm.get.room.playerList[n].isDead then
- p[n].life=p[n].life-3;
- p[name].tempo = os.time();
- ui.addTextArea(1,"",n,6,30,math.floor(p[n].life*2),16,0x00EE00,0x00CD00,70,true)
- ui.addTextArea(2,"<p align='center'><R>"..p[n].life.."/100",n,6,30,200,16,0,0,0,true)
- tfm.exec.setPlayerScore(n,p[n].life,false)
- end
- end
- end
- end
- function eventLoop(t,r)
- if t >= 1000 and time < os.time()-10000 then
- regen();
- end
- end
- function eventPlayerDied(name)
- p[name].life = 0
- ui.addTextArea(1,"",name,6,30,math.floor(p[name].life*2),16,0,0,0,true)
- ui.addTextArea(2,"<p align='center'><font color='#EE2C2C'><font size='18'>You are dead ☠",name,6,25,200,nil,0,0,0,true)
- tfm.exec.setPlayerScore(name,p[name].life,false)
- p[name].life = 1
- vivos = vivos-1;
- if vivos == 1 then
- for i in pairs(tfm.get.room.playerList) do
- if not tfm.get.room.playerList[i].isDead then
- tfm.exec.giveCheese(i)
- tfm.exec.playerVictory(i)
- tfm.exec.newGame(mapas[math.random(#mapas)])
- end
- end
- end
- end
- function regen()
- for n in pairs(tfm.get.room.playerList) do
- if p[n].life < 100 and p[n].life > 0 and not tfm.get.room.playerList[n].isDead then
- p[n].life = p[n].life+math.random(0,8)
- if p[n].life > 100 then
- p[n].life = 100
- end
- ui.addTextArea(1,"",n,6,30,math.floor(p[n].life*2),16,0x00EE00,0x00CD00,70,true)
- ui.addTextArea(2,"<p align='center'><R>"..p[n].life.."/100",n,6,30,200,16,0,0,0,true)
- tfm.exec.setPlayerScore(n,p[n].life,false)
- end
- end
- time=os.time();
- end
- tfm.exec.newGame(mapas[math.random(#mapas)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement