Advertisement
superpaste

transform tfm

Apr 14th, 2017
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.82 KB | None | 0 0
  1. tfm.exec.disableAutoNewGame(true)
  2. tfm.exec.disableAutoShaman(true)
  3. tfm.exec.disableAutoTimeLeft(true)
  4. tfm.exec.disableAfkDeath(true)
  5. tfm.exec.disableAutoScore(true)
  6. transf = {}
  7. stamina = {}
  8. angle = {}
  9. parent = {}
  10. talked = ""
  11. par = ""
  12. function new()
  13. tfm.exec.newGame(math.random(0, 20), nil)
  14. end
  15. function eventLoop(p, r)
  16. if not(par == "") then
  17. if transf[par] then
  18. ui.addTextArea(3, par .. ": " .. talked, nil, ((tfm.get.room.objectList[parent[par]].x - 200) / 1.2) + 200, tfm.get.room.objectList[parent[par]].y, 0, 0, 0x123450, 0x123450, 1, false)
  19. else
  20. ui.removeTextArea(3, nil)
  21. par = ""
  22. talked = ""
  23. end
  24. end
  25. if r < 0 then
  26. new()
  27. end
  28. for i, v in pairs(tfm.get.room.playerList) do
  29. if transf[i] then
  30. stamina[i] = stamina[i] - 0.1
  31. if stamina[i] < 0.1 then
  32. eventTextAreaCallback(1, i, 1)
  33. stamina[i] = 0
  34. end
  35. else
  36. stamina[i] = stamina[i] + 0.05
  37. end
  38. if stamina[i] > 1 then
  39. ui.addTextArea(2, stamina[i], i, 0, 380, 0, 0, 0x123450, 0x123450, 0.9, true)
  40. else
  41. ui.addTextArea(2, stamina[i], i, 0, 380, 0, 0, 0x123450, 0xFFCCCC, 0.9, true)
  42. end
  43. if transf[i] then
  44. have = false
  45. for n, g in pairs(tfm.get.room.objectList) do
  46. if parent[i] == n then
  47. have = true
  48. end
  49. end
  50. if not(have) then
  51. eventTextAreaCallback(1, i, 1)
  52. end
  53. end
  54.  
  55. end
  56. end
  57. function eventNewPlayer(j)
  58. stamina[j] = 1
  59.     transf[j] = false
  60. angle[j] = 0
  61. ui.addTextArea(1, '<a href="event:angle">ângulo a spawnar</a><br/><a href="event:1">caixa pequena</a><br/><a href="event:2">caixa grande</a><br/><a href="event:3">tabua pequena</a><br/><a href="event:4">tabua grande</a><br/><a href="event:6">bola de praia</a><br/><a href="event:7">trampolim</a><br/><a href="event:10">bigorna</a><br/><a href="event:28">balão</a><br/><a href="event:32">runa</a>', jogador, 0, 20, 200, 0, 0x123450, 0x123450, 0.9, true)
  62. ui.addTextArea(2, "", j, 0, 380, 0, 0, 0x123450, 0x123450, 0.9, true)
  63. end
  64.  
  65. function eventPlayerLeft(j)
  66.     if transf[j] == true then
  67.         tfm.exec.removeObject(parent[j])
  68.     end
  69.     transf[j] = nil
  70. alive = alive - 1
  71. end
  72. function eventPlayerDied(j)
  73. if not(transf[j]) then
  74. alive = alive - 1
  75. if alive < 3 then
  76. tfm.exec.setGameTime(20, true)
  77. end
  78. if alive < 1 then
  79. new()
  80. end
  81. end
  82. end
  83.  
  84. function eventPlayerWon(j)
  85. alive = alive - 1
  86. if alive < 3 then
  87. tfm.exec.setGameTime(20, true)
  88. end
  89. if alive < 1 then
  90. new()
  91. end
  92. end
  93. function eventTextAreaCallback(id, j, c)
  94. if c == "angle" then
  95.  ui.addPopup(1, 2, "qual é o ângulo?", j, 200, 200, 400, true)
  96. else
  97. x = tfm.get.room.playerList[j].x
  98. y = tfm.get.room.playerList[j].y
  99.  
  100.  
  101.  
  102.     if transf[j] then
  103.         transf[j] = false
  104.             tfm.exec.respawnPlayer(j)
  105.             for z=1, 5 do
  106.                 tfm.exec.displayParticle(37, tfm.get.room.objectList[parent[j]].x, tfm.get.room.objectList[parent[j]].y, math.random(-10,10), math.random(-10,10), 0, 0, nil)
  107.             end
  108.             tfm.exec.movePlayer(j, tfm.get.room.objectList[parent[j]].x, tfm.get.room.objectList[parent[j]].y, false, 0, 0, false)
  109.             tfm.exec.removeObject(parent[j])
  110.            
  111.        
  112.     else
  113.         if tfm.get.room.playerList[j].isDead == false then
  114.             for z=1, 5 do
  115.             tfm.exec.displayParticle(37, x, y, math.random(-10,10), math.random(-10,10), 0, 0, nil)
  116. end
  117. tfm.exec.setPlayerScore(j, 1, true)
  118.             tfm.exec.killPlayer(j)
  119.             parent[j] = tfm.exec.addShamanObject(c, x, y, angle[j], 0, 0, false)
  120.             transf[j] = true
  121.            
  122.         end
  123.     end
  124. end
  125. end
  126.  
  127. for i, v in pairs(tfm.get.room.playerList) do
  128.     eventNewPlayer(i)
  129. end
  130.  
  131. function eventPopupAnswer(id, j, r)
  132. angle[j] = r
  133. end
  134. function eventChatMessage(j, m)
  135. if transf[j] then
  136. ui.addTextArea(3, j .. ": " .. m, nil, ((tfm.get.room.objectList[parent[j]].x - 200) / 1.2) + 200, tfm.get.room.objectList[parent[j]].y, 0, 0, 0x123450, 0x123450, 1, false)
  137. par = j
  138. talked = m
  139. end
  140.  
  141. end
  142.  
  143. function eventNewGame()
  144. alive = #tfm.get.room.playerList
  145. for i, v in pairs(tfm.get.room.playerList) do
  146.     eventNewPlayer(i)
  147. tfm.exec.setPlayerScore(i, 0, false)
  148. end
  149. end
  150. new()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement