Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p={}
- indx=0
- projects={}
- mapas = {6879570,6879586,2173893,4392183,4569940,1870360,6880640,6882237,6882094, 1953765, 1825269, 1601580, 2186266}
- 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(300)
- for i in pairs(tfm.get.room.playerList) do
- p[i].life = 100
- ui.addTextArea(0,"",i,5,25,202,40,0x828282,0x828282,70,true)
- 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
- projects={}
- 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)
- tfm.exec.chatMessage("• <V>[GAME]</V> <CE>Bem-vindo ao The infected mouse.</CE>",name)
- tfm.exec.chatMessage("• <V>[GAME]</V> <VP>Este minigame está em versão de tests.</VP>",name)
- end
- for all in pairs(tfm.get.room.playerList) do
- eventNewPlayer(all)
- end
- function eventChatMessage(name,message)
- local arg = split(message, " ")
- end
- function eventKeyboard(name, key, down, x, y)
- if key == 32 and p[name].tempo < os.time()-1000 then
- if tfm.get.room.playerList[name].isFacingRight then
- l = 25;
- else
- l = -25;
- end
- table.insert(projects,{n=name,d=l,px=x,py=y,c=13,tmp=os.time()})
- p[name].tempo = os.time();
- end
- end
- function eventLoop(t,r)
- if t >= 3000 then
- updateProjectile()
- end
- for i,v in ipairs(projects) do
- if v.tmp < os.time()-800 then
- table.remove(projects,i)
- end
- end
- if t >= 3000 and time < os.time()-3800 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'>Você Morreu",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
- function updateProjectile()
- ids = {}
- for i,v in pairs(projects) do
- for id=1,2 do
- v.px = v.px+v.d
- end
- for i=1,15 do
- if v.d == 25 then
- tfm.exec.displayParticle(v.c, v.px-i, v.py,math.floor(v.d/3))
- else
- tfm.exec.displayParticle(v.c, v.px+i, v.py,math.floor(v.d/3))
- end
- end
- for n,player in pairs(tfm.get.room.playerList) do
- if n ~= v.n and v.px >= player.x - 40 and v.px <= player.x + 40 and v.py >= player.y - 35 and v.py <= player.y + 35 and not tfm.get.room.playerList[n].isDead then
- p[n].life = p[n].life-3;
- tfm.exec.movePlayer(n, 0, 0, false, v.d, 0, true)
- table.insert(ids,i)
- if p[n].life < 1 then
- tfm.exec.killPlayer(n)
- 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
- end
- for index in pairs(ids) do
- table.remove(projects,index)
- end
- end
- tfm.exec.newGame(mapas[math.random(#mapas)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement