Advertisement
KananGamer

[TFM-TROLL-LUA] Meep

Aug 28th, 2017
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.46 KB | None | 0 0
  1. local delay = 3000
  2.  
  3. local dataPlayer={}
  4.  
  5. function eventNewPlayer(name)
  6.     tfm.exec.bindKeyboard(name,32,true,true)
  7.     dataPlayer[name]={
  8.         time=os.time(),
  9.     }
  10. end
  11.  
  12. for name,players in pairs(tfm.get.room.playerList) do
  13.     eventNewPlayer(name)
  14. end
  15.  
  16. function eventKeyboard(name,key,down,x,y)
  17.     if key == 32 then
  18.         if dataPlayer[name].time < os.time()-delay then
  19.             tfm.exec.displayParticle(20,x,y)
  20.             local p1X = x
  21.             local p1Y = y
  22.             for jogador,player in pairs(tfm.get.room.playerList) do
  23.                 local p2X = tfm.get.room.playerList[jogador].x
  24.                 local p2Y = tfm.get.room.playerList[jogador].y
  25.                 local distanceX=(p1X-p2X)-50
  26.                 if distanceX <= 0 then
  27.                     distanceX=-distanceX
  28.                 end
  29.                 local distanceY=(p1Y-p2Y)-50
  30.                 if distanceY <= 0 then
  31.                     distanceY=-distanceY
  32.                 end
  33.                 if p2X < p1X and p2X > p1X-100 and jogador ~= name then
  34.                     tfm.exec.movePlayer(jogador, 0, 0, false, -distanceX, 0, true)
  35.                 end
  36.                 if p2X > p1X and p2X < p1X+100 and jogador ~= name then
  37.                     tfm.exec.movePlayer(jogador, 0, 0, false, distanceX, 0, true)
  38.                 end
  39.                 if p2Y <= p1Y and p2Y >= p1Y-100 and jogador ~= name and p2X > p1X-100 and p2X < p1X+100 then
  40.                     tfm.exec.movePlayer(jogador, 0, 0, false, 0, -distanceY, true)
  41.                 end
  42.                 if p2Y > p1Y and p2Y <= p1Y+100 and jogador ~= name and p2X > p1X-100 and p2X < p1X+100 then
  43.                     tfm.exec.movePlayer(jogador, 0, 0, false, 0, distanceY, true)
  44.                 end
  45.             end
  46.             dataPlayer[name].time = os.time()
  47.         end
  48.     end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement