Advertisement
Guest User

Finalnova's script - All players

a guest
May 1st, 2014
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.52 KB | None | 0 0
  1. function lol(name)
  2. system.bindMouse(name,true)
  3. for i=0,200 do
  4.     tfm.exec.bindKeyboard(name,i,true,true)
  5. end
  6. end
  7.  
  8. for name,player in pairs(tfm.get.room.playerList) do
  9.  lol(name)
  10. end
  11.  
  12. function randomId()
  13.    
  14.     local idHolder = {0,1,9}
  15. return idHolder[math.random(0,#idHolder)]
  16.  
  17. end
  18.  
  19. function eventMouse(n,x,y)
  20.    
  21.     local p = tfm.get.room.playerList[n]
  22.     drawLightining(p.x,p.y,x,y,randomId())
  23.     drawLightining(p.x,p.y,x,y,randomId())
  24.     drawLightining(p.x,p.y,x,y,randomId())
  25.     tfm.exec.movePlayer(n,x,y)
  26.    
  27. end
  28.  
  29. function eventKeyboard(n,k,d,x,y)
  30.  
  31.     local p = tfm.get.room.playerList[n]
  32.     p.x = x
  33.     p.y = y
  34.  
  35. end
  36.  
  37. move = 3
  38. ms = move/20
  39. ma = ms/1200
  40.  
  41. function drawLine(x1,y1,x2,y2,spaces,id)
  42.    
  43.     id = id or 9
  44.     spaces = spaces or 3
  45.    
  46.    
  47.     local distance = getDistance(x1,y1,x2,y2)
  48.     local numOfParticles = math.floor(distance/spaces)
  49.     local angle = getAngle(x1,y1,x2,y2)
  50.         for i=0,numOfParticles do
  51.            
  52.             local dotX = x1+math.cos(angle)*(i*spaces)
  53.             local dotY = y1+math.sin(angle)*(i*spaces)
  54.             tfm.exec.displayParticle(id,dotX,dotY,math.random()*ms-ms/2,math.random()*ms-ms/2,math.random()*ma-ma/2,math.random()*ma-ma/2)
  55.            
  56.         end
  57.        
  58. end
  59.  
  60. function getDistance(x1,y1,x2,y2)
  61.  
  62.     return math.sqrt(math.abs(x1-x2)^2+math.abs(y1-y2)^2)
  63.  
  64. end
  65.  
  66. function getAngle(x1,y1,x2,y2)
  67.    
  68.     return math.atan2(y2-y1,x2-x1)
  69.  
  70. end
  71.  
  72. function radToDeg(i)
  73.    
  74.     i = i*180/math.pi
  75.     i = i<0 and i+360 or i
  76.     return i
  77.  
  78. end
  79.  
  80. function degToRad(i)
  81.    
  82.     return i*math.pi/180
  83.    
  84. end
  85.  
  86.  
  87. function drawLightining(x1,y1,x2,y2,id)
  88.    
  89.     local ang = getAngle(x1,y1,x2,y2)
  90.     local dis = getDistance(x1,y1,x2,y2)
  91.     local rd = function() return math.random()*25+25 end
  92.     local ra = function() return math.pi/(math.random()*120+30) end
  93.     local wave = {}
  94.     local addWave = function(k,xx,yy) wave[k] = {x=xx,y=yy} end
  95.    
  96.     --------------------------------------
  97.    
  98.     addWave(0,x1,y1)
  99.     local td = 0
  100.     local randomDistance = rd()
  101.     local randomAngle = ra()*((dis-td)/100)
  102.     local zigZag = math.random()<0.5 and 1 or -1
  103.     local ca = ang + randomAngle*zigZag
  104.    
  105.    
  106.     while randomDistance<dis-td do
  107.        
  108.         td = td + randomDistance
  109.        
  110.         local tx = x1+math.cos(ca)*td
  111.         local ty = y1+math.sin(ca)*td
  112.        
  113.         addWave(#wave+1,tx,ty)
  114.        
  115.         randomDistance = rd()
  116.         randomAngle = ra()*((dis-td)/100)
  117.         zigZag = zigZag * -1
  118.         ca = ang + randomAngle*zigZag
  119.        
  120.     end
  121.    
  122.     addWave(#wave+1,x2,y2)
  123.    
  124.     for i=0,#wave-1 do
  125.        
  126.         local cw = wave[i]
  127.         local nw = wave[i+1]
  128.         drawLine(cw.x,cw.y,nw.x,nw.y,3,id)
  129.        
  130.     end
  131.    
  132.    
  133. end
  134. tfm.exec.newGame(0)
  135. tfm.exec.disableAutoNewGame(true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement