Advertisement
Dudugz-Contistente

Untitled

Oct 13th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.25 KB | None | 0 0
  1. tfm.exec.disableAutoShaman();
  2. tfm.exec.disableAutoNewGame();
  3. tfm.exec.disableAutoTimeLeft();
  4. tfm.exec.disableAutoScore();
  5.  
  6. maps_, data, shootCN, c, difficulty = {7284892,6953348,7214244,6891734,1539148,6549805,495880,6684273,1026249,6622204,741041,6631961,1545834,291643,1485498,860865,6240668,802958,7042435,2842113,6938129,1794873,311496,392646,7049134,1519483,7142792,3540608,852617,279689,399420,281649,289964,390649,2284187,289932,281462,866256,6999034,280159,3107377,307930,6789296,1659906,306360,6793381,697561,3587860,290546,6786189,481676}, {}, os.time(), {x=nil,y=nil,mx=math.random(80,180),my=math.random(-20,20),isFacingRight=false,dir=0,angle=0},{nvl=1,tm=3000,new=os.time()}
  7.  
  8. effect={0,4}
  9. mapCode='@Nil'
  10. nextMap=false
  11. scoreshow=false
  12.  
  13. langues = {
  14. [98114]={
  15. ['L_name'] = 'Português Brasileiro',
  16. ['T_welcome'] = 'Olá %s bem-vind(o/a) ao Auto Survivor 0.2 Alpha.',
  17. ['scoreboard'] = {
  18. ['T_name'] = 'Placar de Pontuação',
  19. ['T_PlayerName'] = 'Nome do Jogador',
  20. ['T_Points'] = 'Pontos',
  21. }
  22. },
  23.  
  24. [101110]={
  25. ['L_name'] = 'International English',
  26. ['T_welcome'] = 'Hello %s, welcome to Auto Survivor 0.2 Alpha.',
  27. ['scoreboard'] = {
  28. ['T_name'] = 'Scoreboard',
  29. ['T_PlayerName'] = ' PlayerName ',
  30. ['T_Points'] = 'Points',
  31. }
  32. },
  33.  
  34. [101115]={
  35. ['L_name'] = 'Espanõl',
  36. ['T_welcome'] = 'Hola %s, Bienvenido a Auto Survivor 0.2 Alpha.',
  37. ['scoreboard'] = {
  38. ['T_name'] = 'Placar de puntuación',
  39. ['T_PlayerName'] = ' Nombre ',
  40. ['T_Points'] = 'Puntos',
  41. }
  42. },
  43.  
  44. avaible=function(langue)
  45. return (langues[tonumber(string.byte(langue:sub(1,1))..string.byte(langue:sub(2,2)))] and true or false)
  46. end,
  47.  
  48. translate=function(langue,get)
  49. local langueID, toreturn, _L,__L;
  50. langueID = tonumber(string.byte(langue:sub(1,1))..string.byte(langue:sub(2,2)))
  51.  
  52. _L,__L = table.unpack(get)
  53.  
  54. if __L == nil then
  55. toreturn = langues[langueID][_L]
  56. else
  57. toreturn = langues[langueID][_L][__L]
  58. end
  59.  
  60. return toreturn
  61. end
  62. }
  63.  
  64. textarea=ui.addTextArea
  65. function ui.addTextArea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha,emboss,active,active2)
  66. --if not backgroundColor then backgroundColor=0x324650 end
  67. --if not borderColor then borderColor=0x000001 end
  68. if active then
  69. textarea(6969+id,"",targetPlayer,x,y+1,width,height,0x000001,0x000001,backgroundAlpha)
  70. textarea(7979+id,"",targetPlayer,x,y-1,width,height,0x6A8FA2,0x6A8FA2,backgroundAlpha)
  71. end
  72.  
  73. if active2 then
  74. textarea(6969+id,"",targetPlayer,x,y+1,width,height,0x000001,0x000001,backgroundAlpha)
  75. end
  76.  
  77. textarea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha)
  78. end
  79.  
  80. getRandomData=function()
  81. local players = {}
  82. for n,v in pairs(tfm.get.room.playerList) do if not v.isDead then table.insert(players,v) end end
  83. return players[math.random(#players)]
  84. end
  85.  
  86. function eventNewGame() scoreshow = false nextMap = false mapCode = tfm.get.room.currentMap tfm.exec.setGameTime(100) shootCN = os.time() c.x = nil c.y = nil difficulty.nvl = 1 difficulty.tm = 3000 difficulty.new = os.time() end
  87.  
  88. ScoreBoard=function(...)
  89. if ... =='close' then
  90. for i = 3940,3946 do
  91. for _,id in pairs({i,6969+i,7979+i}) do ui.removeTextArea(id,nil) end
  92. end
  93. elseif ... =='open' and not scoreshow then
  94. local players, positions, names, points = {}, "", "", ""
  95.  
  96. for n, v in pairs(tfm.get.room.playerList) do
  97. if #players < 6 then
  98. if n:sub(1,1) ~= '*' then
  99. if v.score >= 500 then
  100. v.score=500
  101. tfm.exec.setPlayerScore(n,500,false)
  102. end
  103.  
  104. players[#players+1] = {n=n,p=v.score}
  105. end
  106. else
  107. break
  108. end
  109. end
  110.  
  111. table.sort(players,function(a,b) return a.p>b.p end)
  112.  
  113. for k,p in pairs(players) do
  114. m = k
  115. if m < 10 then m = '0'..m end
  116. positions = positions.."<J>"..m..".</J><br><br>"
  117. names = names.."<V>"..p.n.."</V><br><br>"
  118. points = points.."<G>"..p.p.."</G><br><br>"
  119. end
  120.  
  121. ui.addTextArea(3940,"",nil,250,50,300,274,0x324650,0x324650,nil,true,true)
  122. ui.addTextArea(3941,"<p align='center'><font size='14'><N2>ScoreBoard (Top 8)</N2></p></p>",nil,250,51,300,20,0x324650,0x324650,1,true,false,true)
  123. ui.addTextArea(3942,"<J>##.</J> <V> PlayerName </V> <G>Points</G><br><N2>_________________________________________</N2>",nil,252,90,296,232,0x22333b,0x22333b,1,true,false,false)
  124. ui.addTextArea(3943,positions,nil,252,120,25,180,0,0,0,true)
  125. ui.addTextArea(3944,names,nil,280,120,100,180,0,0,0,true)
  126. ui.addTextArea(3945,points,nil,368,120,40,180,0,0,0,true)
  127. ui.addTextArea(3946,"<N2><br><br><br>_________________________________________<br><br>_________________________________________<br><br>_________________________________________<br><br>_________________________________________<br><br>_________________________________________</N2><br><br>_________________________________________</N2><br><br>_________________________________________</N2>",nil,252,90,296,220,0,0,0,true,false,true)
  128. scoreshow=true
  129. end
  130. end
  131.  
  132. function eventLoop(t,r)
  133. if t < 3000 then
  134. shootCN = os.time();
  135. end
  136.  
  137. if t >= 3000 then
  138. local a = 0; for i,v in pairs(tfm.get.room.playerList) do if not v.isDead then a=a+1 end end
  139.  
  140. if r <= 5000 or a == 1 then
  141. for i,v in pairs(tfm.get.room.playerList) do if not v.isDead then tfm.exec.giveCheese(i)tfm.exec.playerVictory(i) end end
  142. end
  143.  
  144. if not nextMap and (a == 0 or r <= 5000) then nextMap=true tfm.exec.setGameTime(10) end
  145.  
  146. if nextMap and (r <= 10000) then if (r <= 0) then tfm.exec.newGame(maps_[math.random(#maps_)]) ScoreBoard('close') else ScoreBoard('open') end end
  147.  
  148. if difficulty.new < os.time()-15000 then
  149. difficulty.nvl = difficulty.nvl + 1
  150. difficulty.tm = difficulty.tm - 500
  151. difficulty.new = os.time();
  152.  
  153. tfm.exec.chatMessage('<VP>New difficulty: <V>'..difficulty.nvl..'</V>.</VP>')
  154. end
  155.  
  156. if c.x == nil and c.y == nil then
  157. p = getRandomData();
  158.  
  159. if p ~= nil then
  160. c.x = p.x
  161. c.y = p.y
  162. c.dir = math.random(1,9)
  163. c.mx = (c.dir ~= 3 and math.random(80,180) or math.random(-10,10))
  164. c.my = (c.dir ~= 3 and math.random(-20,20) or -math.random(80,250))
  165. c.isFacingRight=p.isFacingRight
  166. c.angle = (c.dir ~= 3 and (c.isFacingRight and math.random(260,275) or math.random(80,95)) or math.random(175,185))
  167. if c.angle >= 80 and c.angle <= 95 then c.angle_ = c.angle-180 end
  168. if c.angle >= 175 and c.angle <= 185 then c.angle_ = c.angle-180 end
  169. if c.angle >= 260 and c.angle <= 275 then c.angle_ = c.angle-180 end
  170. else
  171. c.x = -999
  172. c.y = -999
  173. c.mx = 0
  174. c.my = 0
  175. c.isFacingRight=false
  176. end
  177. end
  178.  
  179. if c.x ~= -999 and c.y ~= -999 then
  180. if shootCN < os.time()-(difficulty.tm/2) then tfm.exec.addShamanObject(0,(c.x+(c.isFacingRight and c.mx or -c.mx))+math.random(-4,4), (c.dir ~= 3 and (c.y+(p.isFacingRight and c.my or -c.my)) or c.y+c.my),c.angle_) end
  181. for i=1,math.random(2,5) do tfm.exec.displayParticle (effect[math.random(#effect)], (c.x+(c.isFacingRight and c.mx or -c.mx))+math.random(-4,4), (c.y+(p.isFacingRight and c.my or -c.my)), 0, math.random(0.8,2)) end
  182. if shootCN < os.time()-difficulty.tm then a = (c.dir ~= 3 and tfm.exec.addShamanObject((not c.isDead and 17 or -1),(not c.isDead and (c.isFacingRight and c.x+c.mx or c.x-c.mx) or nil),c.y+c.my,c.angle) or tfm.exec.addShamanObject((not c.isDead and 17 or -1),(not c.isDead and (c.isFacingRight and c.x+c.mx or c.x-c.mx) or nil),c.y+c.my,c.angle)) c.x=nil c.y=nil shootCN = os.time(); end
  183. end
  184. end
  185.  
  186. ui.setMapName("Auto Survivor <BL>|</BL> <G>"..mapCode.."</G> <BL>|</BL> <N>Difficulty : <V>"..difficulty.nvl.."</V></N>")
  187. end
  188.  
  189. function eventPlayerWon(name)
  190. tfm.exec.setPlayerScore(name,2,true)
  191. end
  192.  
  193. function eventPlayerDied(name)
  194. tfm.exec.setPlayerScore(name,1,true)
  195. end
  196.  
  197. function eventNewPlayer(name)
  198. data[name]=(data[name] and data[name] or
  199. {
  200. langue = (langues.avaible(tfm.get.room.playerList[name].community) and tfm.get.room.playerList[name].community or 'en')
  201. })
  202. tfm.exec.chatMessage("<VP>→</VP> <PT>"..string.format(langues.translate(data[name].langue,{'T_welcome'}),name).."</PT>",name)
  203. end
  204.  
  205. for _,v in pairs(tfm.get.room.playerList) do eventNewPlayer(_) if v.score > 0 then tfm.exec.setPlayerScore(_,0,false) end end
  206.  
  207. tfm.exec.newGame(maps_[math.random(#maps_)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement