Advertisement
Xlyjc

X1 sem fly (Team)

Dec 26th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.92 KB | None | 0 0
  1. ui.addTextArea(0, "Enjoy by Xlyjc", nil, 690, 370, 100, 20, 0x000000, 0xff00dd, 1, true)
  2. tfm.exec.disableAutoShaman()
  3. tfm.exec.disableAutoNewGame()
  4. tfm.exec.disableAutoTimeLeft()
  5.  
  6. local ADMINISTRADOR = "Xlyjc" -- Coloque seu nick para ser admin
  7. local WINS = 10 -- Pontos para ganhar
  8. system.disableChatCommandDisplay("np", true)
  9.  
  10. --[[
  11. After running the script, use the command !team1 Players and !team2 Players to set both players in the specified team
  12. Then you just need to press GO!
  13. Type !np @mapcode to run the next map.
  14. Type !score team1/team2 number to change its score.
  15. ]]
  16.  
  17. local teams = {
  18. [1] = {},
  19. [2] = {},
  20. }
  21. local points = {
  22. [1] = 0,
  23. [2] = 0,
  24. }
  25. local isfirst = false
  26. local gameRunning = false
  27. local winTime = false
  28. local playersInGame = {}
  29. local maps = {
  30. 114122, 116630, 148424, 150692, 156510, 165843, 166705, 180191, 180274, 180619, 196433, 198715, 208058, 208162, 209708, 212542, 213697, 217900, 223986, 226883, 227851, 229830, 231905, 232451, 232791, 236146, 239826, 239880, 241211, 242708, 245223, 246790, 255542, 258717, 260377, 261720, 266930, 271523, 277731, 281730, 286333, 287268, 299002, 299971, 305677, 308694, 308992, 309029, 314159, 315801, 317754, 323085, 323366, 332210, 332290, 339896, 340069, 341239, 343971, 344865, 345257, 348801, 349140, 352381, 355957, 356982, 357328, 359521, 363638, 365464, 365652, 367520, 381569, 381669, 386029, 391693, 391831, 393851, 401778, 405295, 405955, 410813, 412657, 414460, 414899, 416015, 418293, 418658, 419374, 421717, 423672, 424795, 425030, 425600, 429822, 429897, 430145, 431142, 431887, 434887, 445167, 447556, 470727, 471053, 477370, 499687, 501711, 504409, 505109, 507325, 508106, 508796, 509082, 512927, 514982, 531569, 536235, 563484, 571512, 594883, 595447, 606723, 611320, 616433, 664949, 694900, 737841, 813156, 849224, 982242, 1015582, 1033170, 1051384, 1058681, 1142116, 1195842, 1208798, 1214182, 1216253, 1255148, 1311059, 1364063, 1375345, 1448760, 1506007, 1512355, 1538895, 1601492, 1608638, 1619934, 1654841, 1663380, 1663415, 1689382, 1702169, 1724289, 1749434, 1768347, 1787232, 1813728, 1851968, 1856349, 1862823, 1927270, 1951856, 1956002, 1964752, 2012147, 2030343, 2070768, 2134537, 2141379, 2150335, 2221510, 2245005, 2331474, 2369254, 2683170, 2726034, 2796001, 2813487, 2816067, 3008155, 3156569, 3213562, 3444803, 3518418, 3537419, 3548376, 3548406, 3572407, 3575034, 3575108, 3620542, 3638794, 3654416, 3669435, 3676555, 3680223, 3685382, 3688419, 3700684, 3705931, 3716560, 3821104, 3889414, 4000001, 4234556, 4645670, 4707191, 4815404, 4911122, 4915220, 4946442, 5000090, 5024682, 5030579, 5032745, 5272513, 5346212, 5349806, 5408572, 5452432, 5495901, 5557858, 5590554, 5591416, 5712914, 5805021, 5813480, 5813783, 5861874, 5886041, 5972342, 6069526, 6112855, 6114810, 6172897, 6226519, 6276662, 6300594
  31. }
  32. local colors = {
  33. [1] = "32FF00",
  34. [2] = "FFF500"
  35. }
  36. local queue = {}
  37.  
  38. function newMap()
  39. local mapcode = maps[math.random(#maps)]
  40. if #queue > 0 then
  41. mapcode = queue[1]
  42. table.remove(queue, 1)
  43. end
  44. tfm.exec.newGame(mapcode)
  45. for player, data in pairs(tfm.get.room.playerList) do
  46. if not playersInGame[player] then
  47. tfm.exec.killPlayer(player)
  48. end
  49. end
  50. tfm.exec.setGameTime(60)
  51. end
  52.  
  53. function eventPlayerWon(player)
  54. if not isfirst then
  55. isfirst = true
  56. tfm.exec.setGameTime(5)
  57. if table.contains(teams[1], player) then
  58. tfm.exec.setGameTime(5)
  59. for i = 0, 3 do
  60. defaultEffect(9, {13}, math.random(800), math.random(400), 20)
  61. end
  62. points[1] = points[1]+1
  63. elseif table.contains(teams[2], player) then
  64. tfm.exec.setGameTime(5)
  65. for i = 0, 3 do
  66. defaultEffect(9, {9}, math.random(800), math.random(400), 20)
  67. end
  68. points[2] = points[2]+1
  69. else
  70. isfirst = false
  71. end
  72. winner = false
  73. if points[1] >= WINS then
  74. winner = 1
  75. elseif points[2] >= WINS then
  76. winner = 2
  77. end
  78. if winner then
  79. gameRunning = false
  80. winTime = os.time()
  81. ui.addTextArea(20, string.format("<p align='center'><font size='37' color='#000000'>O time %s ganhou!", winner), nil, 0, 171, 800, 500, 0, 0, 0, true)
  82. ui.addTextArea(21, string.format("<p align='center'><font size='37' color='#FFFFFF'>O time %s ganhou!", winner), nil, 1, 170, 800, 500, 0, 0, 0, true)
  83. ui.addTextArea(22, string.format("<p align='center'><font size='37' color='#%s'>O time %s ganhou!", colors[winner], winner), nil, 1, 170, 800, 500, 0, 0, 0, true)
  84. end
  85. displayScore()
  86. end
  87. end
  88.  
  89. function eventLoop(elapsed, remain)
  90. if gameRunning then
  91. remain = remain/1000
  92. if remain < 0 then
  93. remain = 100
  94. newMap()
  95. end
  96. else
  97. if winTime then
  98. if winTime > os.time()-30000 then
  99. for i = 0, 2 do
  100. defaultEffect(9, {11, 9, 0, 13}, math.random(800), math.random(400), 80)
  101. end
  102. else
  103. winTime = false
  104. ui.removeTextArea(20)
  105. ui.removeTextArea(21)
  106. ui.removeTextArea(22)
  107. displayTeams()
  108. teams = {
  109. [1] = {},
  110. [2] = {},
  111. }
  112. points = {
  113. [1] = 0,
  114. [2] = 0,
  115. }
  116. playersInGame = {}
  117. end
  118. end
  119. end
  120. end
  121.  
  122. function eventChatCommand(player, command)
  123. if player:lower() == ADMINISTRADOR:lower() then
  124. args = string.split(command, " ")
  125. if args[1] == "time1" then
  126. table.remove(args, 1)
  127. teams[1] = {}
  128. points[1] = 0
  129. for index, player in pairs(args) do
  130. table.insert(teams[1], player)
  131. playersInGame[player] = true
  132. end
  133. displayTeams()
  134.  
  135. elseif args[1] == "time2" then
  136. table.remove(args, 1)
  137. teams[2] = {}
  138. points[2] = 0
  139. for index, player in pairs(args) do
  140. table.insert(teams[2], player)
  141. playersInGame[player] = true
  142. end
  143. displayTeams()
  144.  
  145. elseif args[1] == "score" then
  146. if args[2] and args[3] then
  147. local team = tonumber(args[2]:match("team(%d+)") or 0)
  148. if team > 0 and team < 3 then
  149. local newScore = tonumber(args[3]) or points[team]
  150. points[team] = newScore
  151. displayScore()
  152. end
  153. end
  154. elseif args[1] == "np" then
  155. if args[2] then
  156. table.insert(queue, args[2])
  157. end
  158. end
  159. end
  160. end
  161.  
  162. function eventNewGame()
  163. if gameRunning then
  164. isfirst = false
  165. for i, p in pairs(teams[1]) do
  166. tfm.exec.setNameColor(p, "0-"..colors[1])
  167. end
  168. for i, p in pairs(teams[2]) do
  169. tfm.exec.setNameColor(p, "0-"..colors[2])
  170. end
  171. displayScore()
  172. end
  173. end
  174.  
  175. function displayScore()
  176. ui.addTextArea(17, string.format("<p align='center'><font size='23' color='#0100FF'>%s Time1#-#Time2 %s", points[1], points[2]), nil, 0, 21, 800, 30, 0, 0, 0, true)
  177. ui.addTextArea(18, string.format("<p align='center'><font size='23' color='#0100FF'>%s Time1#-#Time2 %s", points[1], points[2]), nil, 1, 20, 800, 30, 0, 0, 0, true)
  178. ui.addTextArea(19, string.format("<p align='center'><font size='23'><font color='#%s'>%s<N> Time1#-#Time2 <font color='#%s'>%s", colors[1], points[1], colors[2], points[2]), nil, 0, 20, 800, 30, 0, 0, 0, true)
  179. end
  180.  
  181. function displayTeams()
  182. ui.addTextArea(1, "Time 1", nil, 186, 94, 104, 24, 0x000000, 0x0022ff, 1, true)
  183. ui.addTextArea(2, "Time 2", nil, 480, 94, 104, 24, 0x000000, 0xff0000, 1, true)
  184. ui.addTextArea(3, "", nil, 384, 86, 4, 260, 0x000000, 0x00ff44, 1, true)
  185. ui.addTextArea(4, "", nil, 188, 140, 166, 198, 0x000000, 0x0022ff, 1, true)
  186. ui.addTextArea(5, "", nil, 418, 142, 166, 198, 0x000000, 0xff0000, 1, true)
  187. ui.addTextArea(11, "<p align='center'><font color='#"..colors[1].."'>"..table.concat(teams[1], "\n"), nil, 188, 142, 162, 194, 0x000000, 0x000000, 1, true)
  188. ui.addTextArea(13, "<p align='center'><font color='#"..colors[2].."'>"..table.concat(teams[2], "\n"), nil, 418, 142, 166, 198,0x000000, 0x000000, 1, true)
  189. ui.addTextArea(16, "<p align='center'><V><a href='event:iniciarJogo'>GO", ADMINISTRADOR, 374, 206, 22, 20, 0x000000, 0x00ff26, 1, true)
  190. end
  191.  
  192. function eventTextAreaCallback(id, player, callback)
  193. if callback == 'iniciarJogo' then
  194. if #teams[2] > 0 and #teams[1] > 0 then
  195. gameRunning = true
  196. for i = 1, 16 do
  197. ui.removeTextArea(i)
  198. end
  199. defaultEffect(9, {9}, 400, 212, 80)
  200. newMap()
  201. end
  202. end
  203. end
  204.  
  205. function string.split(s, pattern, n)
  206. local st = {}
  207. for sb in string.gmatch(s, "[^"..pattern.."]+") do
  208. if not n or n > -1 then
  209. table.insert(st,sb)
  210. else
  211. st[#st] = st[#st]..pattern..sb
  212. end
  213. n = n and n-1 or false
  214. end
  215. return st
  216. end
  217.  
  218. function table.contains(tableT, element)
  219. for _, value in pairs(tableT) do
  220. if value == element then
  221. return true
  222. end
  223. end
  224. return false
  225. end
  226.  
  227. defaultEffect=function(id,p,x,y,rand) -- thanks for the function santah
  228. local minDist = 1
  229. local outerBorder = 20
  230. local maxDist = 30
  231. local totalParticles = rand and 40 or (id == -1 and 35 or 75)
  232. for i = 1, totalParticles do
  233. if rand then
  234. id = p[math.random(#p)]
  235. end
  236. local dist = math.min(math.random(minDist, maxDist), outerBorder)
  237. local angle = math.random(0, 360)
  238. local r = math.rad(angle)
  239. local dx = math.cos(r)
  240. local dy = math.sin(r)
  241. local vx = dist * dx / 10
  242. local vy = dist * dy / 10
  243. local ax = -vx / dist / 15
  244. local ay = (-vy / dist / 15) + 0.05
  245. if id == -1 then
  246. tfm.exec.displayParticle(9, x + dx, y + dy, vx, vy, ax, ay, nil)
  247. tfm.exec.displayParticle(1, x + dx, y + dy, vx, vy, ax, ay, nil)
  248. else
  249. tfm.exec.displayParticle(id, x + dx, y + dy, vx, vy, ax, ay, nil)
  250. end
  251. end
  252. end
  253.  
  254. displayTeams()
  255.  
  256. function eventPlayerDied()
  257. local alive = 0
  258. for k,v in pairs(tfm.get.room.playerList) do
  259. if not v.isDead then
  260. alive = alive+1
  261. end
  262. end
  263. if alive < 2 then
  264. tfm.exec.setGameTime(5)
  265. end
  266. end
  267.  
  268. tfm.exec.disableAutoShaman()
  269. tfm.exec.disableAutoNewGame()
  270. tfm.exec.disableAutoTimeLeft()
  271.  
  272. local ADMINISTRADOR = "Xlyjc" -- CHANGE TO YOUR NICKNAME, SO YOU WILL BE GAME ADMIN
  273. local WINS = 10 -- POINTS TO WIN THE GAME
  274. system.disableChatCommandDisplay("np", true)
  275.  
  276. --[[
  277. After running the script, use the command !team1 Players and !team2 Players to set both players in the specified team
  278. Then you just need to press GO!
  279. Type !np @mapcode to run the next map.
  280. Type !score team1/team2 number to change its score.
  281. ]]
  282.  
  283. local teams = {
  284. [1] = {},
  285. [2] = {},
  286. }
  287. local points = {
  288. [1] = 0,
  289. [2] = 0,
  290. }
  291. local isfirst = false
  292. local gameRunning = false
  293. local winTime = false
  294. local playersInGame = {}
  295. local maps = {
  296. 114122, 116630, 148424, 150692, 156510, 165843, 166705, 180191, 180274, 180619, 196433, 198715, 208058, 208162, 209708, 212542, 213697, 217900, 223986, 226883, 227851, 229830, 231905, 232451, 232791, 236146, 239826, 239880, 241211, 242708, 245223, 246790, 255542, 258717, 260377, 261720, 266930, 271523, 277731, 281730, 286333, 287268, 299002, 299971, 305677, 308694, 308992, 309029, 314159, 315801, 317754, 323085, 323366, 332210, 332290, 339896, 340069, 341239, 343971, 344865, 345257, 348801, 349140, 352381, 355957, 356982, 357328, 359521, 363638, 365464, 365652, 367520, 381569, 381669, 386029, 391693, 391831, 393851, 401778, 405295, 405955, 410813, 412657, 414460, 414899, 416015, 418293, 418658, 419374, 421717, 423672, 424795, 425030, 425600, 429822, 429897, 430145, 431142, 431887, 434887, 445167, 447556, 470727, 471053, 477370, 499687, 501711, 504409, 505109, 507325, 508106, 508796, 509082, 512927, 514982, 531569, 536235, 563484, 571512, 594883, 595447, 606723, 611320, 616433, 664949, 694900, 737841, 813156, 849224, 982242, 1015582, 1033170, 1051384, 1058681, 1142116, 1195842, 1208798, 1214182, 1216253, 1255148, 1311059, 1364063, 1375345, 1448760, 1506007, 1512355, 1538895, 1601492, 1608638, 1619934, 1654841, 1663380, 1663415, 1689382, 1702169, 1724289, 1749434, 1768347, 1787232, 1813728, 1851968, 1856349, 1862823, 1927270, 1951856, 1956002, 1964752, 2012147, 2030343, 2070768, 2134537, 2141379, 2150335, 2221510, 2245005, 2331474, 2369254, 2683170, 2726034, 2796001, 2813487, 2816067, 3008155, 3156569, 3213562, 3444803, 3518418, 3537419, 3548376, 3548406, 3572407, 3575034, 3575108, 3620542, 3638794, 3654416, 3669435, 3676555, 3680223, 3685382, 3688419, 3700684, 3705931, 3716560, 3821104, 3889414, 4000001, 4234556, 4645670, 4707191, 4815404, 4911122, 4915220, 4946442, 5000090, 5024682, 5030579, 5032745, 5272513, 5346212, 5349806, 5408572, 5452432, 5495901, 5557858, 5590554, 5591416, 5712914, 5805021, 5813480, 5813783, 5861874, 5886041, 5972342, 6069526, 6112855, 6114810, 6172897, 6226519, 6276662, 6300594
  297. }
  298. local colors = {
  299. [1] = "32FF00",
  300. [2] = "FFF500"
  301. }
  302. local queue = {}
  303.  
  304. function newMap()
  305. local mapcode = maps[math.random(#maps)]
  306. if #queue > 0 then
  307. mapcode = queue[1]
  308. table.remove(queue, 1)
  309. end
  310. tfm.exec.newGame(mapcode)
  311. for player, data in pairs(tfm.get.room.playerList) do
  312. if not playersInGame[player] then
  313. tfm.exec.killPlayer(player)
  314. end
  315. end
  316. tfm.exec.setGameTime(60)
  317. end
  318.  
  319. function eventPlayerWon(player)
  320. if not isfirst then
  321. isfirst = true
  322. tfm.exec.setGameTime(5)
  323. if table.contains(teams[1], player) then
  324. tfm.exec.setGameTime(5)
  325. for i = 0, 3 do
  326. defaultEffect(9, {13}, math.random(800), math.random(400), 20)
  327. end
  328. points[1] = points[1]+1
  329. elseif table.contains(teams[2], player) then
  330. tfm.exec.setGameTime(5)
  331. for i = 0, 3 do
  332. defaultEffect(9, {9}, math.random(800), math.random(400), 20)
  333. end
  334. points[2] = points[2]+1
  335. else
  336. isfirst = false
  337. end
  338. winner = false
  339. if points[1] >= WINS then
  340. winner = 1
  341. elseif points[2] >= WINS then
  342. winner = 2
  343. end
  344. if winner then
  345. gameRunning = false
  346. winTime = os.time()
  347. ui.addTextArea(20, string.format("<p align='center'><font size='37' color='#000000'>O time %s ganhou!", winner), nil, 0, 171, 800, 500, 0, 0, 0, true)
  348. ui.addTextArea(21, string.format("<p align='center'><font size='37' color='#FFFFFF'>O time %s ganhou!", winner), nil, 1, 170, 800, 500, 0, 0, 0, true)
  349. ui.addTextArea(22, string.format("<p align='center'><font size='37' color='#%s'>O time %s ganhou!", colors[winner], winner), nil, 1, 170, 800, 500, 0, 0, 0, true)
  350. end
  351. displayScore()
  352. end
  353. end
  354.  
  355. function eventLoop(elapsed, remain)
  356. if gameRunning then
  357. remain = remain/1000
  358. if remain < 0 then
  359. remain = 100
  360. newMap()
  361. end
  362. else
  363. if winTime then
  364. if winTime > os.time()-30000 then
  365. for i = 0, 2 do
  366. defaultEffect(9, {11, 9, 0, 13}, math.random(800), math.random(400), 80)
  367. end
  368. else
  369. winTime = false
  370. ui.removeTextArea(20)
  371. ui.removeTextArea(21)
  372. ui.removeTextArea(22)
  373. displayTeams()
  374. teams = {
  375. [1] = {},
  376. [2] = {},
  377. }
  378. points = {
  379. [1] = 0,
  380. [2] = 0,
  381. }
  382. playersInGame = {}
  383. end
  384. end
  385. end
  386. end
  387.  
  388. function eventChatCommand(player, command)
  389. if player:lower() == ADMINISTRADOR:lower() then
  390. args = string.split(command, " ")
  391. if args[1] == "team1" then
  392. table.remove(args, 1)
  393. teams[1] = {}
  394. points[1] = 0
  395. for index, player in pairs(args) do
  396. table.insert(teams[1], player)
  397. playersInGame[player] = true
  398. end
  399. displayTeams()
  400.  
  401. elseif args[1] == "team2" then
  402. table.remove(args, 1)
  403. teams[2] = {}
  404. points[2] = 0
  405. for index, player in pairs(args) do
  406. table.insert(teams[2], player)
  407. playersInGame[player] = true
  408. end
  409. displayTeams()
  410.  
  411. elseif args[1] == "score" then
  412. if args[2] and args[3] then
  413. local team = tonumber(args[2]:match("team(%d+)") or 0)
  414. if team > 0 and team < 3 then
  415. local newScore = tonumber(args[3]) or points[team]
  416. points[team] = newScore
  417. displayScore()
  418. end
  419. end
  420. elseif args[1] == "np" then
  421. if args[2] then
  422. table.insert(queue, args[2])
  423. end
  424. end
  425. end
  426. end
  427.  
  428. function eventNewGame()
  429. if gameRunning then
  430. isfirst = false
  431. for i, p in pairs(teams[1]) do
  432. tfm.exec.setNameColor(p, "0-"..colors[1])
  433. end
  434. for i, p in pairs(teams[2]) do
  435. tfm.exec.setNameColor(p, "0-"..colors[2])
  436. end
  437. displayScore()
  438. end
  439. end
  440.  
  441. function displayScore()
  442. ui.addTextArea(17, string.format("<p align='center'><font size='23' color='#0100FF'>%s Time1#-#Time2 %s", points[1], points[2]), nil, 0, 21, 800, 30, 0, 0, 0, true)
  443. ui.addTextArea(18, string.format("<p align='center'><font size='23' color='#0100FF'>%s Time1#-#Time2 %s", points[1], points[2]), nil, 1, 20, 800, 30, 0, 0, 0, true)
  444. ui.addTextArea(19, string.format("<p align='center'><font size='23'><font color='#%s'>%s<N> Time1#-#Time2 <font color='#%s'>%s", colors[1], points[1], colors[2], points[2]), nil, 0, 20, 800, 30, 0, 0, 0, true)
  445. end
  446.  
  447. function displayTeams()
  448. ui.addTextArea(1, "Time 1", nil, 186, 94, 104, 24, 0x000000, 0x0022ff, 1, true)
  449. ui.addTextArea(2, "Time 2", nil, 480, 94, 104, 24, 0x000000, 0xff0000, 1, true)
  450. ui.addTextArea(3, "", nil, 384, 86, 4, 260, 0x000000, 0x00ff44, 1, true)
  451. ui.addTextArea(4, "", nil, 188, 140, 166, 198, 0x000000, 0x0022ff, 1, true)
  452. ui.addTextArea(14, "Criador :", nil, 316, 96, 54, 20, 0x9900ff, 0x000000, 1, true)
  453. ui.addTextArea(15, "Xlyjc\n", nil, 402, 96, 54, 20, 0x9900ff, 0x000000, 1, true)
  454. ui.addTextArea(5, "", nil, 418, 142, 166, 198, 0x000000, 0xff0000, 1, true)
  455. ui.addTextArea(11, "<p align='center'><font color='#"..colors[1].."'>"..table.concat(teams[1], "\n"), nil, 188, 142, 162, 194, 0x000000, 0x000000, 1, true)
  456. ui.addTextArea(13, "<p align='center'><font color='#"..colors[2].."'>"..table.concat(teams[2], "\n"), nil, 418, 142, 166, 198,0x000000, 0x000000, 1, true)
  457. ui.addTextArea(16, "<p align='center'><V><a href='event:iniciarJogo'>GO", ADMINISTRADOR, 374, 206, 22, 20, 0x000000, 0x00ff26, 1, true)
  458. end
  459.  
  460. function eventTextAreaCallback(id, player, callback)
  461. if callback == 'iniciarJogo' then
  462. if #teams[2] > 0 and #teams[1] > 0 then
  463. gameRunning = true
  464. for i = 1, 16 do
  465. ui.removeTextArea(i)
  466. end
  467. defaultEffect(9, {9}, 400, 212, 80)
  468. newMap()
  469. end
  470. end
  471. end
  472.  
  473. function string.split(s, pattern, n)
  474. local st = {}
  475. for sb in string.gmatch(s, "[^"..pattern.."]+") do
  476. if not n or n > -1 then
  477. table.insert(st,sb)
  478. else
  479. st[#st] = st[#st]..pattern..sb
  480. end
  481. n = n and n-1 or false
  482. end
  483. return st
  484. end
  485.  
  486. function table.contains(tableT, element)
  487. for _, value in pairs(tableT) do
  488. if value == element then
  489. return true
  490. end
  491. end
  492. return false
  493. end
  494.  
  495. defaultEffect=function(id,p,x,y,rand) -- thanks for the function santah
  496. local minDist = 1
  497. local outerBorder = 20
  498. local maxDist = 30
  499. local totalParticles = rand and 40 or (id == -1 and 35 or 75)
  500. for i = 1, totalParticles do
  501. if rand then
  502. id = p[math.random(#p)]
  503. end
  504. local dist = math.min(math.random(minDist, maxDist), outerBorder)
  505. local angle = math.random(0, 360)
  506. local r = math.rad(angle)
  507. local dx = math.cos(r)
  508. local dy = math.sin(r)
  509. local vx = dist * dx / 10
  510. local vy = dist * dy / 10
  511. local ax = -vx / dist / 15
  512. local ay = (-vy / dist / 15) + 0.05
  513. if id == -1 then
  514. tfm.exec.displayParticle(9, x + dx, y + dy, vx, vy, ax, ay, nil)
  515. tfm.exec.displayParticle(1, x + dx, y + dy, vx, vy, ax, ay, nil)
  516. else
  517. tfm.exec.displayParticle(id, x + dx, y + dy, vx, vy, ax, ay, nil)
  518. end
  519. end
  520. end
  521.  
  522. displayTeams()
  523.  
  524. function eventPlayerDied()
  525. local alive = 0
  526. for k,v in pairs(tfm.get.room.playerList) do
  527. if not v.isDead then
  528. alive = alive+1
  529. end
  530. end
  531. if alive < 2 then
  532. tfm.exec.setGameTime(5)
  533. end
  534. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement