Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- newData = {}
- MapFolder = {0,1,2,3,4,5}
- Agents = 0
- Criminals = 0
- Live = 0
- InRoom = 1
- time = 0
- -- @Inicio do jogo
- StartTime = false
- StartGame = false
- -- @Jogador entra na sala
- function eventNewPlayer(name)
- InRoom = InRoom + 1
- newData[name] = {
- Experience = 0,
- Life = 100,
- Level = 0,
- Seized = 0,
- Team = "",
- }
- end
- --@Jogadores necessários para iniciar a partida
- if InRoom < 1 then
- ui.setMapName("<CE>É necessário mais jogadores para iniciar a partida</CE>")
- tfm.exec.setGameTime(99999)
- end
- if (not StartTime) then
- if InRoom >= 1 then
- time = 20
- StartTime = true
- end
- end
- --@Evento do Loop
- function eventLoop(currentTime,timeRemaining)
- if StartTime then
- if time > 0 then
- time = (time - 0.5)
- if (not tostring(time):find('.5')) then
- ui.setMapName("<CE>A partida começa em "..(time + 1).." segundos.</CE>")
- end
- elseif (not StartGame) then
- StartTime = false
- StartGame = true
- tfm.exec.newGame(MapFolder[math.random(#MapFolder)])
- end
- if (timeRemaining <= 15000 or Agents == 0 or Criminals == 0) and timeRemaining >= 19500 then
- local Triumph = ""
- for name in pairs(tfm.get.room.playerList) do
- if Agents > Criminals then
- Triumph = "Agents"
- elseif Criminals > Agents then
- Triumph = "Criminals"
- elseif Criminals == Agents then
- Triumph = "No winners"
- tfm.exec.killPlayer(i)
- end
- if newData[name].Team == Triumph then
- tfm.exec.chatMessage("<R>Os "..Triumph.." ganharam",name)
- end
- end
- tfm.exec.newGame(MapFolder[math.random(#MapFolder)])
- end
- end
- end
- --@Coisas que acontecerão quando uma nova partida iniciar
- function eventNewGame()
- Agents = 0
- Criminals = 0
- TeamPlayer = math.random(0,1)
- for name in pairs(tfm.get.room.playerList) do
- if TeamPlayer == 0 then
- newData[name].Team = "Agents"
- Agents = Agents + 1
- newData[name].Seized = 0
- tfm.exec.setNameColor(name, 0x2F7FCC)
- TeamPlayer = 1
- else
- newData[name].Team = "Criminals"
- Criminals = Criminals + 1
- newData[name].Seized = 0
- tfm.exec.setNameColor(name, 0xCB546B)
- TeamPlayer = 0
- end
- end
- end
- --@Configurações do teclado
- for name in pairs(tfm.get.room.playerList) do
- for _,key in pairs{0,32} do
- system.bindKeyboard(name, key, true)
- end
- end
- --@
- function eventKeyboard(name, key, down, x, y)
- if key == 32 then
- for n,player in pairs(tfm.get.room.playerList) do
- if name ~= n and newData[n].Team == "Criminals" and newData[n].Life ~= 0 and x >= player.x - 15 and x <= player.x + 15 and y >= player.y - 15 and y <= player.y + 15 then
- newData[n].captured = newData[n].captured + 1
- newData[n].Life = newData[n].Life - 10
- tfm.exec.displayParticle(5,x,y,-0.2,-0.2,0,0)
- elseif name ~= n and newData[n].Team == "Agents" and newData[n].Life ~= 0 and x >= player.x - 15 and x <= player.x + 15 and y >= player.y - 15 and y <= player.y + 15 then
- newData[n].Life = newData[n].Life - 10
- tfm.exec.displayParticle(5,x,y,-0.2,-0.2,0,0)
- break
- end
- end
- end
- end
- table.foreach(tfm.get.room.playerList,eventNewPlayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement