Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- BaffVamp
- -- Tables
- minigame={
- ["version"]="1.0";
- ["vampiros"]=0;
- ["ratos"]=0;
- ["alive"]=0;
- };
- players={}
- toDespawn={}
- mapas={"258972","334445","423793","615791","760329","812007","946893","955523","1296883","1542025","1638989","1676629","1782151","2389613","2393716","2403639","2428213","2429313","2435372","2541364","2561153","2563004","2680717","2683284","2686097","2693083","2761246","2821033","2910904","2929496","2938327","2940045","2944932","2951616","2953590","2956031","2956156","2971085","2975699","2976059","2983430","2986318","2999898","3001393","3006311","3020988","3027934","3032840","3033710","3044452","3057493","3061098","3068111","3069138","3079426","3090849","3101671","3103683","3105156","3110659","3119050","3120924","3128337","3140275","3167932","3170618","3187755","3195331","3197349","3225462","3240230","3270111","3292389","3296041","3333339","3334083","3337200","3359267","3377553","3430472","3435288","3460936","3482009","3485896","3488764","3509662","3515991","3611033","3745155","3745168","3808004","3946003"}
- vamp=false;
- -- Inicio do Script
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.newGame(mapas[math.random(#mapas)])
- -- Ffa
- -- Dar keys
- function eventNewPlayer(name)
- for i,key in ipairs({32,40,83}) do
- tfm.exec.bindKeyboard(name,key,true,true)
- end
- players[name]={
- timestamp=os.time(),
- offsets={x=2, y=10}
- }
- end
- for player in pairs(tfm.get.room.playerList) do
- eventNewPlayer(player)
- end
- -- Eventos do teclado
- function eventKeyboard(name,key,down,x,y)
- if (key==32 or key==40 or key==83) and not tfm.get.room.playerList[name].isDead and started and not tfm.get.room.playerList[name].isVampire then
- if players[name].timestamp < os.time()-1000 then
- local id
- if tfm.get.room.playerList[name].isFacingRight then
- id=tfm.exec.addShamanObject(19,x+players[name].offsets.x,y+players[name].offsets.y)
- else
- id=tfm.exec.addShamanObject(20,x+players[name].offsets.x,y+players[name].offsets.y)
- end
- players[name].timestamp=os.time()
- table.insert(toDespawn,{os.time(),id})
- end
- end
- if (key==32 or key==40 or key==83) and not tfm.get.room.playerList[name].isDead and started and tfm.get.room.playerList[name].isVampire then
- tfm.exec.movePlayer(name,xx,yy,false,0,-50,false)
- end
- end
- -- Player vira vampiro
- function eventPlayerVampire(player)
- if vamp == false then
- vamp=true;
- end
- minigame.vampiros=minigame.vampiros+1;
- minigame.ratos=minigame.ratos-1;
- teamWon()
- end
- -- Jogador morre
- function eventPlayerDied(player)
- if tfm.get.room.playerList[player].isVampire then
- minigame.vampiros=minigame.vampiros-1;
- end
- if not tfm.get.room.playerList[player].isVampire then
- minigame.ratos=minigame.ratos-1;
- end
- minigame.alive=minigame.alive-1;
- teamWon()
- end
- -- Loop
- function eventLoop(time,rt)
- if time >= 3000 and not started then
- started=true
- end
- if rt<=0 or minigame.alive == 0 then
- tfm.exec.newGame(mapas[math.random(#mapas)])
- end
- for i,cannon in ipairs(toDespawn) do
- if cannon[1] <= os.time()-3000 then
- tfm.exec.removeObject(cannon[2])
- table.remove(toDespawn,i)
- end
- end
- tfm.exec.setUIMapName("<R>Vampiros :<N2> "..minigame.vampiros.." <G>| <CH>Ratos :<N2> "..minigame.ratos.."")
- end
- -- Novo Jogador
- function eventNewGame()
- vamp=false;
- started=false;
- minigame.vampiros=0;
- minigame.ratos=0;
- minigame.alive=0;
- for player in pairs(tfm.get.room.playerList) do
- minigame.ratos=minigame.ratos+1;
- minigame.alive=minigame.alive+1;
- end
- ui.removeTextArea(0,NIL)
- end
- -- Verificar time ganhador
- function teamWon()
- if vamp == true then
- if minigame.vampiros == 0 then
- ui.addTextArea(0,"<p align='center'><font size='18'><VP>Os <CH>ratos<VP> ganharam a partida!</font></p>",NIL,300,150,200,50,1,1,0.5,true)
- for player in pairs(tfm.get.room.playerList) do
- tfm.exec.giveCheese(player)
- tfm.exec.playerVictory(player)
- end
- tfm.exec.setGameTime(15)
- end
- if minigame.ratos == 0 then
- ui.addTextArea(0,"<p align='center'><font size='18'><VP>Os <R>vampiros<VP> ganharam a partida!</font></p>",NIL,300,150,200,50,1,1,0.5,true)
- tfm.exec.setGameTime(15)
- end
- end
- end
- -- Jogador ganha
- function eventPLayerWon(player)
- minigame.alive=minigame.alive+1;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement