Advertisement
Papaneige

[LUA] ☘️ Magic Tricks ☘️

May 24th, 2019
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.95 KB | None | 0 0
  1. --Auteur: Papaneige#0000
  2.  
  3. function main()
  4. tfm.exec.disableAutoNewGame(true)
  5. tfm.exec.disableAutoShaman(true)
  6. tfm.exec.newGame(7593531)
  7. tfm.exec.setUIMapName("<VP>☘️ <R>Magic Tricks <VP>☘ <BL>| <I> <V>By Papaneige#0000")
  8. tfm.exec.disableAutoScore(true)
  9. tfm.exec.disableAfkDeath (true)
  10. end
  11.  
  12. function eventTextAreaCallback(aide, name, callback)
  13. ui.addPopup (1, 0, "Bienvenue dans le module <font color='#578710'> ☘️ </font><font color='#DB270F'> Magic Tricks </font> <font color='#578710'> ☘ </font>! Dans ce module vous devrez faire preuve d'agilité et de rapidité si vous voulez être le premier à remporter la partie! Mais prenez garde, votre parcours ne sera pas de tout repos. En effet, le module a été ensorcelé et vous jettera des sorts pour embusquer votre chemin vers la gloire. Heureusement, le développeur du module a été gentil et vous laisse 3 tp pour vous aider dans votre quête! Attention utilisez-les avec parcimonie (il est où?) à l'aide d'un simple clique de souris sur l'écran. <br>Module created by <font color='#2979C6'>Papaneige#0000</font>.</br><br>Special thank to <font color='#66F600'>Tortugreen#0000</font> for his help with tp.</br>", name, 165, 150, 490, true)
  14. end
  15.  
  16. souris=0
  17. play=0
  18. reste=4
  19. maps = {7580643,7579987,7580638,7582312,7582323,7582327,7582481,7582478,7582565,7582869,7582936}
  20. params={nombreTP=0}
  21.  
  22. function eventNewPlayer(name)
  23.  
  24. ui.removeTextArea(1,nil)
  25. ui.addTextArea(0, "<a href='event:aide'>?</a>", name, 5, 25,10,15,0x49FFBA,0xFFFFFF,0.4,true)
  26. system.bindMouse (name, true)
  27. tfm.exec.respawnPlayer(name)
  28. souris=souris+1
  29. reste=reste-1
  30. if souris>=4 then
  31. tfm.exec.newGame(maps[math.random(#maps)])
  32. tfm.exec.disableAutoShaman(true)
  33. ui.removeTextArea (6, nil)
  34. play=1
  35. elseif play==0 then
  36. ui.addTextArea(6, "<p align='center'><font color='#FBF600' size='20'>Il manque " ..reste.. " souris pour commencer la partie.</font></p>", nil, 5, 138, 1000, 50, true)
  37. end
  38. end
  39.  
  40. for name in pairs(tfm.get.room.playerList) do
  41. params[name]={nombreTP=0}
  42. end
  43.  
  44. for name in pairs(tfm.get.room.playerList) do
  45. eventNewPlayer(name)
  46. tfm.exec.disableAutoShaman(true)
  47. function eventMouse (name,xp, yp)
  48. if params[name].nombreTP<=2 and (math.abs(xp-tfm.get.room.playerList[name].x) <=100) and (math.abs(yp-tfm.get.room.playerList[name].y) <=100) or (math.abs(xp-tfm.get.room.playerList[name].x) <=-100) and (math.abs(yp-tfm.get.room.playerList[name].y) <=-100) then
  49. tfm.exec.movePlayer (name, xp, yp, false, 0, 0, false)
  50. params[name].nombreTP=params[name].nombreTP+1
  51. elseif params[name].nombreTP == 3 then
  52. ui.addTextArea(7, "<p align='center'><font color='#F21616' size='20'>Tu as déjà utilisé tes 3 tp !</font></p>", name, -75, 20, 1000, 50, true)
  53. end
  54. end
  55. end
  56.  
  57. function eventPlayerLeft(name)
  58. souris = souris-1
  59. if souris<=3 and play==1 then
  60. tfm.exec.newGame(7593531)
  61. play=0
  62. tfm.exec.addConjuration (0, 0,0)
  63. reste=reste+1
  64. ui.addTextArea(6, "<p align='center'><font color='#FBF600' size='20'>Il manque " ..reste.. " souris pour commencer la partie.</font></p>", nil, 5, 138, 1000, 50, true)
  65. ui.removeTextArea (1, nil)
  66. ui.removeTextArea (2, nil)
  67. ui.removeTextArea (3, nil)
  68. ui.removeTextArea (4, nil)
  69. elseif souris<=3 and play==0 then
  70. reste=reste+1
  71. ui.addTextArea(6, "<p align='center'><font color='#FBF600' size='20'>Il manque " ..reste.. " souris pour commencer la partie.</font></p>", nil, 5, 138, 1000, 50, true)
  72. ui.removeTextArea (1, nil)
  73. ui.removeTextArea (2, nil)
  74. ui.removeTextArea (3, nil)
  75. ui.removeTextArea (4, nil)
  76. end
  77. end
  78.  
  79. function eventNewGame()
  80. tfm.exec.disableAutoNewGame(true)
  81. tfm.exec.disableAutoShaman(true)
  82. tfm.exec.setUIMapName("<VP>☘️ <R>Magic Tricks <VP>☘ <BL>| <I> <V>By Papaneige#0000")
  83. tfm.exec.disableAutoScore(true)
  84. tfm.exec.disableAfkDeath (true)
  85. end
  86.  
  87. function eventPlayerWon(name)
  88. tfm.exec.respawnPlayer(name)
  89. if v==0 then
  90. params[name].nombreTP=0
  91. ui.addTextArea(1, "<p align='center'><font color='#FBF600' size='20'>Bravo à " ..name.. " qui finit premier!</font></p>", nil, -100, 200, 1000, 50, true)
  92. v=1
  93. tfm.exec.displayParticle(29,30,50,2,2,1,1,nil)
  94. tfm.exec.displayParticle(29,80,50,2,2,1,1,nil)
  95. tfm.exec.displayParticle(29,140,50,2,2,1,1,nil)
  96. tfm.exec.displayParticle(29,190,50,2,2,1,1,nil)
  97. tfm.exec.displayParticle(29,240,50,2,2,1,1,nil)
  98. tfm.exec.displayParticle(29,290,50,2,2,1,1,nil)
  99. tfm.exec.displayParticle(29,340,50,2,2,1,1,nil)
  100. tfm.exec.displayParticle(29,390,50,2,2,1,1,nil)
  101. tfm.exec.displayParticle(29,420,50,2,2,1,1,nil)
  102. tfm.exec.displayParticle(29,490,50,2,2,1,1,nil)
  103. tfm.exec.displayParticle(29,520,50,2,2,1,1,nil)
  104. tfm.exec.displayParticle(29,590,50,2,2,1,1,nil)
  105. tfm.exec.displayParticle(29,620,50,2,2,1,1,nil)
  106. tfm.exec.displayParticle(29,690,50,2,2,1,1,nil)
  107. tfm.exec.displayParticle(29,720,50,2,2,1,1,nil)
  108. tfm.exec.displayParticle(29,790,50,2,2,1,1,nil)
  109. ui.removeTextArea (7, nil)
  110. elseif v==1 then
  111. ui.removeTextArea (1, nil)
  112. ui.addTextArea(2, "<p align='center'><font color='#FBF600' size='20'>Bravo à " ..name.." qui finit 2ème!</font></p>", nil, -100, 200, 1000, 50, true)
  113. v=2
  114. tfm.exec.displayParticle(29,30,50,2,2,1,1,nil)
  115. tfm.exec.displayParticle(29,80,50,2,2,1,1,nil)
  116. tfm.exec.displayParticle(29,140,50,2,2,1,1,nil)
  117. tfm.exec.displayParticle(29,190,50,2,2,1,1,nil)
  118. tfm.exec.displayParticle(29,240,50,2,2,1,1,nil)
  119. tfm.exec.displayParticle(29,290,50,2,2,1,1,nil)
  120. tfm.exec.displayParticle(29,340,50,2,2,1,1,nil)
  121. tfm.exec.displayParticle(29,390,50,2,2,1,1,nil)
  122. tfm.exec.displayParticle(29,420,50,2,2,1,1,nil)
  123. tfm.exec.displayParticle(29,490,50,2,2,1,1,nil)
  124. tfm.exec.displayParticle(29,520,50,2,2,1,1,nil)
  125. tfm.exec.displayParticle(29,590,50,2,2,1,1,nil)
  126. tfm.exec.displayParticle(29,620,50,2,2,1,1,nil)
  127. tfm.exec.displayParticle(29,690,50,2,2,1,1,nil)
  128. tfm.exec.displayParticle(29,720,50,2,2,1,1,nil)
  129. tfm.exec.displayParticle(29,790,50,2,2,1,1,nil)
  130. elseif v==2 then
  131. ui.removeTextArea (2, nil)
  132. ui.addTextArea(3, "<p align='center'><font color='#FBF600' size='20'>Bravo à " ..name.." qui finit 3ème!</font></p>", nil, -100, 200, 1000, 50, true)
  133. v=3
  134. tfm.exec.displayParticle(29,30,50,2,2,1,1,nil)
  135. tfm.exec.displayParticle(29,80,50,2,2,1,1,nil)
  136. tfm.exec.displayParticle(29,140,50,2,2,1,1,nil)
  137. tfm.exec.displayParticle(29,190,50,2,2,1,1,nil)
  138. tfm.exec.displayParticle(29,240,50,2,2,1,1,nil)
  139. tfm.exec.displayParticle(29,290,50,2,2,1,1,nil)
  140. tfm.exec.displayParticle(29,340,50,2,2,1,1,nil)
  141. tfm.exec.displayParticle(29,390,50,2,2,1,1,nil)
  142. tfm.exec.displayParticle(29,420,50,2,2,1,1,nil)
  143. tfm.exec.displayParticle(29,490,50,2,2,1,1,nil)
  144. tfm.exec.displayParticle(29,520,50,2,2,1,1,nil)
  145. tfm.exec.displayParticle(29,590,50,2,2,1,1,nil)
  146. tfm.exec.displayParticle(29,620,50,2,2,1,1,nil)
  147. tfm.exec.displayParticle(29,690,50,2,2,1,1,nil)
  148. tfm.exec.displayParticle(29,720,50,2,2,1,1,nil)
  149. tfm.exec.displayParticle(29,790,50,2,2,1,1,nil)
  150. elseif v==3 then
  151. ui.removeTextArea (3, nil)
  152. ui.addTextArea(4, "<p align='center'><font color='#FBF600' size='20'>Bravo à " ..name, nil, -100, 200, 1000, 50, true)
  153. tfm.exec.displayParticle(29,30,50,2,2,1,1,nil)
  154. tfm.exec.displayParticle(29,80,50,2,2,1,1,nil)
  155. tfm.exec.displayParticle(29,140,50,2,2,1,1,nil)
  156. tfm.exec.displayParticle(29,190,50,2,2,1,1,nil)
  157. tfm.exec.displayParticle(29,240,50,2,2,1,1,nil)
  158. tfm.exec.displayParticle(29,290,50,2,2,1,1,nil)
  159. tfm.exec.displayParticle(29,340,50,2,2,1,1,nil)
  160. tfm.exec.displayParticle(29,390,50,2,2,1,1,nil)
  161. tfm.exec.displayParticle(29,420,50,2,2,1,1,nil)
  162. tfm.exec.displayParticle(29,490,50,2,2,1,1,nil)
  163. tfm.exec.displayParticle(29,520,50,2,2,1,1,nil)
  164. tfm.exec.displayParticle(29,590,50,2,2,1,1,nil)
  165. tfm.exec.displayParticle(29,620,50,2,2,1,1,nil)
  166. tfm.exec.displayParticle(29,690,50,2,2,1,1,nil)
  167. tfm.exec.displayParticle(29,720,50,2,2,1,1,nil)
  168. tfm.exec.displayParticle(29,790,50,2,2,1,1,nil)
  169. end
  170. end
  171.  
  172. function eventPlayerDied(name)
  173. tfm.exec.respawnPlayer(name)
  174. end
  175.  
  176. maps = {7580643,7579987,7580638,7582312,7582323,7582327,7582481,7582478,7582565,7582869,7582936}
  177. conjy = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,}
  178. conjx = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79}
  179. v = 0
  180.  
  181. function eventLoop(timePast, timeLeft)
  182. if play==1 then
  183. if timeLeft <= 220000 then
  184. tfm.exec.addConjuration (conjx[math.random(#conjx)], conjy[math.random(#conjy)], 1000000)
  185. if timeLeft <= 115000 then
  186. ui.removeTextArea (5, nil)
  187. if timeLeft <= 100 and v==0 then
  188. ui.addTextArea(5, "<p align='center'><font color='#FBF600' size='20'>Personne n'a gagné cette fois!", nil, 150, 200, 500, 50, true)
  189. tfm.exec.newGame(maps[math.random(#maps)])
  190. v=0
  191. ui.removeTextArea (1, nil)
  192. ui.removeTextArea (2, nil)
  193. ui.removeTextArea (3, nil)
  194. ui.removeTextArea (4, nil)
  195. ui.removeTextArea (7, nil)
  196. elseif timeLeft <= 0 then
  197. tfm.exec.newGame(maps[math.random(#maps)])
  198. v=0
  199. ui.removeTextArea (1, nil)
  200. ui.removeTextArea (2, nil)
  201. ui.removeTextArea (3, nil)
  202. ui.removeTextArea (4, nil)
  203. ui.removeTextArea (7, nil)
  204. end
  205. end
  206. end
  207. end
  208. end
  209.  
  210. main ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement