Advertisement
Novohp

blacklist ???

Dec 12th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.30 KB | None | 0 0
  1. newData = {}
  2. MapFolder = {0,1,2,3,4,5}
  3. Agents = 0
  4. Criminals = 0
  5. Live = 0
  6. InRoom = 1
  7. time = 0
  8. -- @Inicio do jogo
  9. StartTime = false
  10. StartGame = false
  11. -- @Jogador entra na sala
  12. function eventNewPlayer(name)
  13.   InRoom = InRoom + 1
  14.   newData[name] = {
  15.     Experience = 0,
  16.     Life = 100,
  17.     Level = 0,
  18.     Seized = 0,
  19.     Team = "",
  20.   }
  21. end
  22. --@Jogadores necessários para iniciar a partida
  23. if InRoom < 1 then
  24.   ui.setMapName("<CE>É necessário mais jogadores para iniciar a partida</CE>")
  25.   tfm.exec.setGameTime(99999)
  26. end
  27. if (not StartTime) then
  28.   if InRoom >= 1 then
  29.     time = 20
  30.     StartTime = true
  31.   end
  32. end
  33. --@Evento do Loop
  34. function eventLoop(currentTime,timeRemaining)
  35.   if StartTime then
  36.     if time > 0 then
  37.       time = (time - 0.5)
  38.       if (not tostring(time):find('.5')) then
  39.         ui.setMapName("<CE>A partida começa em "..(time + 1).." segundos.</CE>")
  40.       end
  41.       elseif (not StartGame) then
  42.         StartTime = false
  43.         StartGame = true
  44.         tfm.exec.newGame(MapFolder[math.random(#MapFolder)])
  45.     end
  46.     if (timeRemaining <= 15000 or Agents == 0 or Criminals == 0) and timeRemaining >= 19500 then
  47.       local Triumph = ""
  48.         for name in pairs(tfm.get.room.playerList) do
  49.           if Agents > Criminals then
  50.             Triumph = "Agents"
  51.           elseif Criminals > Agents then
  52.             Triumph = "Criminals"
  53.           elseif Criminals == Agents then
  54.             Triumph = "No winners"
  55.             tfm.exec.killPlayer(i)
  56.           end
  57.           if newData[name].Team == Triumph then
  58.             tfm.exec.chatMessage("<R>Os "..Triumph.." ganharam",name)
  59.           end
  60.         end
  61.       tfm.exec.newGame(MapFolder[math.random(#MapFolder)])
  62.     end
  63.   end
  64. end
  65. --@Coisas que acontecerão quando uma nova partida iniciar
  66. function eventNewGame()
  67.   Agents = 0
  68.   Criminals = 0
  69.   TeamPlayer = math.random(0,1)
  70.   for name in pairs(tfm.get.room.playerList) do
  71.     if TeamPlayer == 0 then
  72.       newData[name].Team = "Agents"
  73.       Agents = Agents + 1
  74.       newData[name].Seized = 0
  75.       tfm.exec.setNameColor(name, 0x2F7FCC)
  76.       TeamPlayer = 1
  77.     else
  78.       newData[name].Team = "Criminals"
  79.       Criminals = Criminals + 1
  80.       newData[name].Seized = 0
  81.       tfm.exec.setNameColor(name, 0xCB546B)
  82.       TeamPlayer = 0
  83.     end
  84.   end
  85. end
  86. --@Configurações do teclado
  87. for name in pairs(tfm.get.room.playerList) do
  88.   for _,key in pairs{0,32} do
  89.     system.bindKeyboard(name, key, true)
  90.   end
  91. end
  92. --@
  93. function eventKeyboard(name, key, down, x, y)
  94.   if key == 32 then
  95.     for n,player in pairs(tfm.get.room.playerList) do
  96.       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
  97.         newData[n].captured = newData[n].captured + 1              
  98.         newData[n].Life = newData[n].Life - 10
  99.         tfm.exec.displayParticle(5,x,y,-0.2,-0.2,0,0)
  100.       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
  101.         newData[n].Life = newData[n].Life - 10
  102.         tfm.exec.displayParticle(5,x,y,-0.2,-0.2,0,0)  
  103.       break
  104.     end
  105.     end
  106.   end
  107. end
  108. table.foreach(tfm.get.room.playerList,eventNewPlayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement