Advertisement
Guest User

Try or write

a guest
Dec 28th, 2017
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.10 KB | None | 0 0
  1. for _, v in next, {"utoNewGame", "utoShaman", "utoTimeLeft", "fkDeath", "utoScore"} do
  2. tfm.exec['disableA'..v]()
  3. end
  4.  
  5. local isTribeHouse = tfm.get.room.name:byte(2) == 3
  6.  
  7. local fundos = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
  8. local fundo = fundos[math.random(#fundos)]
  9.  
  10. local xml = '<C><P F="'..fundo..'" /><Z><S><S L="10" X="93" H="404" Y="222" T="14" P="0,0,0,0,0,0,0,0" /><S L="801" X="400" H="165" Y="467" T="1" P="0,0,0,0.2,0,0,0,0" /><S L="10" H="404" X="220" Y="209" T="14" P="0,0,0,0,0,0,0,0" /><S L="10" X="357" H="404" Y="207" T="14" P="0,0,0,0,0,0,0,0" /><S L="10" H="404" X="502" Y="207" T="14" P="0,0,0,0,0,0,0,0" /><S L="10" X="654" H="404" Y="207" T="14" P="0,0,0,0,0,0,0,0" /></S><D><DS Y="356" X="47" /><T Y="381" X="773" /></D><O /></Z></C>'
  11.  
  12. local contagem = 10000;
  13. local tempo = os.time();
  14. local s = 0
  15. local s2 = 10
  16.  
  17. local data = {}
  18.  
  19. local admins = {Flyingwr = true, Rianmojang1 = true}
  20.  
  21. local alfabeto = {
  22. vogais = {
  23. "a", "e", "i", "o", "u", ""
  24. },
  25. consoantes = {
  26. "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z"
  27. }
  28. };
  29. local palavra = false;
  30.  
  31. local maxVogais = 3; -- Máximo de vogais na palavra gerada. Exemplo: "Irineu" (4 vogais)
  32. local maxCons = 2; -- Máximo de consoantes na palavra gerada. Exemplo "aailrqqtcytmmdcszgdklcjgkr" (22 consoantes)
  33.  
  34. local vogal, consoante;
  35.  
  36. function gerador()
  37. palavra = '';
  38.  
  39. for i=1, maxVogais+maxCons do
  40. for _,v in next,alfabeto.vogais do
  41. if string.len(palavra) < maxVogais then
  42. vogal = alfabeto.vogais[math.random(#alfabeto.vogais)];
  43. palavra = palavra .. vogal;
  44. end
  45. end
  46. for _,v in next,alfabeto.consoantes do
  47. if (string.len(palavra) < maxCons + maxVogais) then
  48. consoante = alfabeto.consoantes[math.random(#alfabeto.consoantes)];
  49. palavra = palavra .. consoante;
  50. end
  51. end
  52. end
  53.  
  54. if isTribeHouse then
  55. print("<v>[Script] <n>Palavra : " .. palavra)
  56. else
  57. for k, v in next, admins do
  58. tfm.exec.chatMessage("<v>[Script] <n>Palavra : " .. palavra, k)
  59. end
  60. end
  61. end
  62.  
  63. function string.split(str,s)
  64. local res = {}
  65. for part in string.gmatch(str, "[^" .. s .. "]+") do
  66. table.insert(res, part)
  67. end
  68. return res
  69. end
  70.  
  71. function eventNewPlayer(name)
  72. data[name] = {
  73. p = 0,
  74. }
  75. end
  76. table.foreach(tfm.get.room.playerList, eventNewPlayer)
  77.  
  78. function eventChatCommand(name, cmd)
  79. local cmd = string.split(cmd, " ")
  80. if admins[name] then
  81. if not isTribeHouse then
  82. if cmd[1] == "pw" then
  83. if cmd[2] then
  84. tfm.exec.setRoomPassword(cmd[2])
  85. for k, v in next, admins do
  86. tfm.exec.chatMessage("<v>[Script] <n>Senha da sala : " .. cmd[2] .. ". Colocada por <v>" .. name .. "<n>.", k)
  87. end
  88. else
  89. tfm.exec.setRoomPassword("")
  90. for k, v in next, admins do
  91. tfm.exec.chatMessage("<v>[Script] <n>Senha da sala removida por <v>" .. name .. "<n>.", k)
  92. end
  93. end
  94. elseif cmd[1] == "lock" then
  95. if cmd[2] then
  96. tfm.exec.setRoomMaxPlayers(tonumer(cmd[2]))
  97. for k, v in next, admins do
  98. tfm.exec.chatMessage("<v>[Script] <n>Sala trancada para " .. cmd[2] .. " ratos por <v>" .. name .. "<n>.", k)
  99. end
  100. end
  101. end
  102. end
  103. end
  104. end
  105.  
  106. function eventChatMessage(name,msg)
  107. if msg == palavra and (s2 <= 0) and not tfm.get.room.playerList[name].isDead then
  108. data[name].p=data[name].p+1
  109. tfm.exec.setPlayerScore(name, data[name].p)
  110. maxVogais = (#palavra < 30 and maxVogais + 3 or maxVogais)
  111. maxCons = (#palavra < 30 and maxCons + 2 or maxCons)
  112. if data[name].p == 1 then
  113. tfm.exec.movePlayer(name,112,369,false,1,1,false)
  114. gerador()
  115. tempo = os.time()
  116. contagem = 10000
  117. s = 0
  118. s2 = 10
  119. elseif data[name].p == 2 then
  120. tfm.exec.movePlayer(name,239,369,false,1,1,false)
  121. gerador()
  122. tempo = os.time()
  123. contagem = 10000
  124. s = 0
  125. s2 = 10
  126. elseif data[name].p == 3 then
  127. tfm.exec.movePlayer(name,376,369,false,1,1,false)
  128. gerador()
  129. tempo = os.time()
  130. contagem = 10000
  131. s = 0
  132. s2 = 10
  133. elseif data[name].p == 4 then
  134. tfm.exec.movePlayer(name,551,369,false,1,1,false)
  135. gerador()
  136. tempo = os.time()
  137. contagem = 10000
  138. s = 0
  139. s2 = 10
  140. elseif data[name].p == 5 then
  141. tfm.exec.movePlayer(name,663,369,false,1,1,false)
  142. tfm.exec.giveCheese(name)
  143. end
  144. end
  145. end
  146.  
  147. function eventLoop(e,r)
  148. s=s+0.5
  149.  
  150. if s == 1 then
  151. s2=s2-1
  152. s=0
  153. end
  154.  
  155. if tempo < os.time() - contagem then
  156. ui.addTextArea(0, "<font size=\"20\">"..palavra.."", nil, 5, 23, 791, 33, 0x324650, 0x000000, 1, true)
  157. else
  158. ui.addTextArea(0, "Proxima palavra em: <CE>"..s2.."", nil)
  159. end
  160.  
  161. if (r/1000) <= 0 then
  162. tfm.exec.newGame(xml)
  163. end
  164. end
  165.  
  166. tfm.exec.newGame(xml)
  167.  
  168. function eventNewGame()
  169. tempo = os.time()
  170. contagem = 10000
  171. s = 0
  172. s2 = 10
  173.  
  174. maxVogais = 3
  175. maxCons = 2
  176.  
  177. gerador()
  178.  
  179. tfm.exec.setGameTime(60*4.5)
  180. ui.setMapName(string.format("<j>Rianmojang1 <bl>- @666"))
  181.  
  182. fundo = fundos[math.random(#fundos)]
  183. xml = '<C><P F="'..fundo..'" /><Z><S><S L="10" X="93" H="404" Y="222" T="14" P="0,0,0,0,0,0,0,0" /><S L="801" X="400" H="165" Y="467" T="1" P="0,0,0,0.2,0,0,0,0" /><S L="10" H="404" X="220" Y="209" T="14" P="0,0,0,0,0,0,0,0" /><S L="10" X="357" H="404" Y="207" T="14" P="0,0,0,0,0,0,0,0" /><S L="10" H="404" X="502" Y="207" T="14" P="0,0,0,0,0,0,0,0" /><S L="10" X="654" H="404" Y="207" T="14" P="0,0,0,0,0,0,0,0" /></S><D><DS Y="356" X="47" /><T Y="381" X="773" /></D><O /></Z></C>'
  184.  
  185. for k, v in next, data do
  186. v.p = 0
  187. tfm.exec.setPlayerScore(k, 0)
  188. end
  189. end
  190.  
  191. function eventPlayerWon(name)
  192. tfm.exec.setGameTime(5)
  193. end
  194.  
  195. function eventPlayerDied(name)
  196. local a = {}
  197.  
  198. for k, v in next, tfm.get.room.playerList do
  199. if not v.isDead then
  200. a[#a + 1] = k
  201. end
  202. end
  203.  
  204. if #a == 0 then
  205. tfm.exec.setGameTime(5)
  206. end
  207. end
  208.  
  209. for k, v in next, {"pw", "lock"} do
  210. system.disableChatCommandDisplay(v)
  211. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement