Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.73 KB | None | 0 0
  1.  
  2. Make sure you stay ahead of the Agile testing curve by implementing the latest Agile practices.
  3. Download Ebook Now!
  4. PASTEBINnew paste
  5. search...
  6.  
  7.  
  8. Guest User
  9. -
  10. SHARE
  11. TWEET
  12.  
  13. Gerenciador de sorteios - Transformice Lua
  14. A GUEST APR 13TH, 2015 1,456 NEVER
  15.  
  16. Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  17. rawdownloadcloneembedreportprintdiff Lua 3.97 KB
  18. -- Gerenciador de sorteios
  19. -- Escrito por Ninguem
  20.  
  21. adm = "Ninguem"
  22. nome = "Sorteio de Teste"
  23. mapa = [[<C><P Ca=""/><Z><S><S H="40" P="0,0,0.3,0.2,0,0,0,0" L="800" X="399" N="" Y="380" T="0" /></S><D /><O /></Z></C>]]
  24.  
  25. participante = {}
  26. inicio = false
  27. fim = false
  28. qtd = 0
  29. fast = 0
  30.  
  31. function eventTextAreaCallback(id, p, cmd)
  32. if cmd == "entrada" then
  33. ui.addTextArea(0, "<p align='center'>Participando", p, 200, 370, 400, 20, 1, 0x00ff00, 0.8,false)
  34. entrada(p, #participante + 1)
  35. elseif cmd == "inicio" then
  36. ui.addPopup(0, 2, "<p align='center'>Quantidade de sorteados", p, 300, 200, 200, false)
  37. elseif cmd == "novo" then
  38. novo()
  39. end
  40. end
  41.  
  42. function eventNewPlayer(p)
  43. if not inicio and not fim then
  44. ui.addTextArea(0, "<p align='center'><a href='event:entrada'>Clique para participar do sorteio!", p, 200, 370, 400, 20, 1, 0xffff00, 0.8, false)
  45. ui.addTextArea(-3, "<p align='center'><font size='30px'>"..nome, p, 5, 40, 795, 40, 1, 1, 0.8, false)
  46. end
  47. end
  48.  
  49. function eventPopupAnswer(id, p, cmd)
  50. if tonumber(cmd, 10) then
  51. if tonumber(cmd, 10) >= 1 and tonumber(cmd, 10) <= #participante then
  52. ui.removeTextArea(0, nil)
  53. ui.removeTextArea(-1, nil)
  54. qtd = tonumber(cmd, 10)
  55. fast = math.random(5,15)
  56. inicio = true
  57. end
  58. end
  59. end
  60.  
  61. function participando(p)
  62. for i, v in pairs(participante) do
  63. if v == p then
  64. return true
  65. end
  66. end
  67. return false
  68. end
  69.  
  70. function entrada(p, num)
  71. if not participando(p) then
  72. participante[num] = p
  73. ui.addTextArea(num, "<p align='center'>" .. p, nil, ((num-1)%8)*100+5, math.floor((num-1)/8)*30+100, 90, 20, 1, 1, 0.8, false)
  74. end
  75. end
  76.  
  77. function novo()
  78. for i=1, #participante do
  79. ui.removeTextArea(i, nil)
  80. table.remove(participante, 1)
  81. end
  82. ui.addTextArea(0, "<p align='center'><a href='event:entrada'>Clique para participar do sorteio!", nil, 200, 370, 400, 20, 1, 0xffff00, 0.8, false)
  83. ui.addTextArea(-1, "<p align='center'><a href='event:inicio'>Iniciar", adm, 650, 370, 100, 20, 1, 0x0000ff, 0.8,false)
  84. tfm.exec.removePhysicObject(0)
  85. fim = false
  86. end
  87.  
  88. function sorteio(tipo)
  89. local lista = {}
  90. local sorteado = 0
  91. for i=1, #participante do
  92. lista[i] = i
  93. end
  94. local rand = 0
  95. for i, v in pairs(participante) do
  96. ui.addTextArea(i, "<p align='center'>" .. v, nil, ((i-1)%8)*100+5, math.floor((i-1)/8)*30+100, 90, 20, 1, 1, 0.8, false)
  97. end
  98. for i=1, qtd do
  99. sorteado = math.random(#lista)
  100. rand = lista[sorteado]
  101. table.remove(lista, sorteado)
  102. if tipo == "quase" then
  103. ui.addTextArea(rand, "<p align='center'><font color='#ffff00'>" .. participante[rand], nil, ((rand-1)%8)*100+5, math.floor((rand-1)/8)*30+100, 90, 20, 1, 0xffff00, 0.8, false)
  104. elseif tipo == "final" then
  105. ui.addTextArea(rand, "<p align='center'><font color='#00ff00'><b>" .. participante[rand], nil, ((rand-1)%8)*100+5, math.floor((rand-1)/8)*30+100, 90, 20, 1, 0x00ff00, 0.8, false)
  106. end
  107. end
  108. end
  109.  
  110. function eventLoop()
  111. if inicio then
  112. if fast > 0 then
  113. sorteio("quase")
  114. fast = fast - 1
  115. else
  116. sorteio("final")
  117. inicio = false
  118. fim = true
  119. ui.addTextArea(-1, "<p align='center'><a href='event:novo'>Novo sorteio", adm, 650, 370, 100, 20, 1, 0x0000ff, 0.8,false)
  120. end
  121. end
  122. if fim then
  123. tfm.exec.addPhysicObject(0, 400, 200, {type=12,color=math.random(0x666666, 0x777777), miceCollision=false, width=800, height=400})
  124. for i=1, 50 do
  125. tfm.exec.displayParticle(math.random(21,24), math.random(1,800), 20, math.random(-20,20)/100, math.random(10,1000)/100, 0, 0, nil)
  126. end
  127. end
  128. end
  129.  
  130. tfm.exec.disableAutoShaman(true)
  131. tfm.exec.disableAutoNewGame(true)
  132. tfm.exec.newGame(mapa)
  133. ui.addTextArea(0, "<p align='center'><a href='event:entrada'>Clique para participar do sorteio!", nil, 200, 370, 400, 20, 1, 0xffff00, 0.8, false)
  134. ui.addTextArea(-1, "<p align='center'><a href='event:inicio'>Iniciar", adm, 650, 370, 100, 20, 1, 0x0000ff, 0.8,false)
  135. ui.addTextArea(-3, "<p align='center'><font size='30px'>"..nome, nil, 5, 40, 795, 40, 1, 1, 0.8, false)
  136. tfm.exec.setUIMapName("Script de sorteios")
  137. RAW Paste Data
  138.  
  139. -- Gerenciador de sorteios
  140. -- Escrito por Ninguem
  141.  
  142. adm = "Ninguem"
  143. nome = "Sorteio de Teste"
  144. mapa = [[<C><P Ca=""/><Z><S><S H="40" P="0,0,0.3,0.2,0,0,0,0" L="800" X="399" N="" Y="380" T="0" /></S><D /><O /></Z></C>]]
  145.  
  146. participante = {}
  147. inicio = false
  148. fim = false
  149. qtd = 0
  150. fast = 0
  151.  
  152. function eventTextAreaCallback(id, p, cmd)
  153. if cmd == "entrada" then
  154. ui.addTextArea(0, "<p align='center'>Participando", p, 200, 370, 400, 20, 1, 0x00ff00, 0.8,false)
  155. entrada(p, #participante + 1)
  156. elseif cmd == "inicio" then
  157. ui.addPopup(0, 2, "<p align='center'>Quantidade de sorteados", p, 300, 200, 200, false)
  158. elseif cmd == "novo" then
  159. novo()
  160. end
  161. end
  162.  
  163. function eventNewPlayer(p)
  164. if not inicio and not fim then
  165. ui.addTextArea(0, "<p align='center'><a href='event:entrada'>Clique para participar do sorteio!", p, 200, 370, 400, 20, 1, 0xffff00, 0.8, false)
  166. ui.addTextArea(-3, "<p align='center'><font size='30px'>"..nome, p, 5, 40, 795, 40, 1, 1, 0.8, false)
  167. end
  168. end
  169.  
  170. function eventPopupAnswer(id, p, cmd)
  171. if tonumber(cmd, 10) then
  172. if tonumber(cmd, 10) >= 1 and tonumber(cmd, 10) <= #participante then
  173. ui.removeTextArea(0, nil)
  174. ui.removeTextArea(-1, nil)
  175. qtd = tonumber(cmd, 10)
  176. fast = math.random(5,15)
  177. inicio = true
  178. end
  179. end
  180. end
  181.  
  182. function participando(p)
  183. for i, v in pairs(participante) do
  184. if v == p then
  185. return true
  186. end
  187. end
  188. return false
  189. end
  190.  
  191. function entrada(p, num)
  192. if not participando(p) then
  193. participante[num] = p
  194. ui.addTextArea(num, "<p align='center'>" .. p, nil, ((num-1)%8)*100+5, math.floor((num-1)/8)*30+100, 90, 20, 1, 1, 0.8, false)
  195. end
  196. end
  197.  
  198. function novo()
  199. for i=1, #participante do
  200. ui.removeTextArea(i, nil)
  201. table.remove(participante, 1)
  202. end
  203. ui.addTextArea(0, "<p align='center'><a href='event:entrada'>Clique para participar do sorteio!", nil, 200, 370, 400, 20, 1, 0xffff00, 0.8, false)
  204. ui.addTextArea(-1, "<p align='center'><a href='event:inicio'>Iniciar", adm, 650, 370, 100, 20, 1, 0x0000ff, 0.8,false)
  205. tfm.exec.removePhysicObject(0)
  206. fim = false
  207. end
  208.  
  209. function sorteio(tipo)
  210. local lista = {}
  211. local sorteado = 0
  212. for i=1, #participante do
  213. lista[i] = i
  214. end
  215. local rand = 0
  216. for i, v in pairs(participante) do
  217. ui.addTextArea(i, "<p align='center'>" .. v, nil, ((i-1)%8)*100+5, math.floor((i-1)/8)*30+100, 90, 20, 1, 1, 0.8, false)
  218. end
  219. for i=1, qtd do
  220. sorteado = math.random(#lista)
  221. rand = lista[sorteado]
  222. table.remove(lista, sorteado)
  223. if tipo == "quase" then
  224. ui.addTextArea(rand, "<p align='center'><font color='#ffff00'>" .. participante[rand], nil, ((rand-1)%8)*100+5, math.floor((rand-1)/8)*30+100, 90, 20, 1, 0xffff00, 0.8, false)
  225. elseif tipo == "final" then
  226. ui.addTextArea(rand, "<p align='center'><font color='#00ff00'><b>" .. participante[rand], nil, ((rand-1)%8)*100+5, math.floor((rand-1)/8)*30+100, 90, 20, 1, 0x00ff00, 0.8, false)
  227. end
  228. end
  229. end
  230.  
  231. function eventLoop()
  232. if inicio then
  233. if fast > 0 then
  234. sorteio("quase")
  235. fast = fast - 1
  236. else
  237. sorteio("final")
  238. inicio = false
  239. fim = true
  240. ui.addTextArea(-1, "<p align='center'><a href='event:novo'>Novo sorteio", adm, 650, 370, 100, 20, 1, 0x0000ff, 0.8,false)
  241. end
  242. end
  243. if fim then
  244. tfm.exec.addPhysicObject(0, 400, 200, {type=12,color=math.random(0x666666, 0x777777), miceCollision=false, width=800, height=400})
  245. for i=1, 50 do
  246. tfm.exec.displayParticle(math.random(21,24), math.random(1,800), 20, math.random(-20,20)/100, math.random(10,1000)/100, 0, 0, nil)
  247. end
  248. end
  249. end
  250.  
  251. tfm.exec.disableAutoShaman(true)
  252. tfm.exec.disableAutoNewGame(true)
  253. tfm.exec.newGame(mapa)
  254. ui.addTextArea(0, "<p align='center'><a href='event:entrada'>Clique para participar do sorteio!", nil, 200, 370, 400, 20, 1, 0xffff00, 0.8, false)
  255. ui.addTextArea(-1, "<p align='center'><a href='event:inicio'>Iniciar", adm, 650, 370, 100, 20, 1, 0x0000ff, 0.8,false)
  256. ui.addTextArea(-3, "<p align='center'><font size='30px'>"..nome, nil, 5, 40, 795, 40, 1, 1, 0.8, false)
  257. tfm.exec.setUIMapName("Script de sorteios")
  258.  
  259. We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
  260. Pastebin PRO 'AUTUMN SPECIAL'!
  261. Get 40% OFF Pastebin PRO accounts!
  262.  
  263. create new paste / dealsnew! / api / scraping api / syntax languages / archive / faq / tools / night mode / go
  264. privacy statement / cookies policy / terms of service / security disclosure / dmca / contact
  265.  
  266. By using Pastebin.com you agree to our cookies policy to enhance your experience.
  267. Site design & logo © 2018 Pastebin; user contributions (pastes) licensed under cc by-sa 3.0 -- Dedicated Server Hosting by Steadfast
  268.  
  269. Top
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement