Advertisement
Eshkation-

Capture as luzes!

May 12th, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. MAPS = {"@5035550","@5036000","@5038425"}
  2.  
  3. tfm.exec.disableAutoShaman(true)
  4. tfm.exec.disableAutoNewGame(true)
  5. tfm.exec.newGame(MAPS[math.random(#MAPS)])
  6. captured = 0
  7.  
  8. X = {}
  9. Y = {}
  10. count = {};
  11. canGo = False
  12. timing = 0
  13.  
  14. function eventNewGame()
  15. tfm.exec.setUIMapName("<ROSE>[!]<N> Capturem todas as luzes! <P")
  16. X = {}
  17. Y = {}
  18. captured = 0
  19. timing = 0
  20.  
  21. XML = tfm.get.room.xmlMapInfo.xml
  22. for xml in tfm.get.room.xmlMapInfo.xml:gmatch("<O[^/]+/>") do
  23. table.insert(X,xml:match('X="(%d+)"'))
  24. table.insert(Y,xml:match('Y="(%d+)"'))
  25. end
  26. for player in pairs(tfm.get.room.playerList) do
  27. count[player]={["counter"]=0;}
  28. end
  29. canGo = true
  30. end
  31.  
  32.  
  33. function eventLoop()
  34. if canGo == true then
  35. stringe = ""
  36. for x = #X,1,-1 do
  37. tfm.exec.displayParticle(9,X[x],Y[x],0,0,0,0,nil)
  38. end
  39. for player,name in pairs(tfm.get.room.playerList) do
  40. for x = #X,1,-1 do
  41. if tfm.get.room.playerList[player].x < X[x]+30 and tfm.get.room.playerList[player].x > X[x]-30 and tfm.get.room.playerList[player].y < Y[x]+30 and tfm.get.room.playerList[player].y > Y[x]-30 then
  42. for y= 30,1,-1 do
  43. ids = {0,1,4,9,11}
  44. tfm.exec.displayParticle(ids[math.random(#ids)],X[x],Y[x],math.random(-5,5),math.random(-5,5),0,true)
  45. end
  46. X[x] = 9999
  47. count[player]["counter"] = count[player]["counter"]+1
  48. captured = captured+1
  49. end
  50. end
  51. stringe = stringe..string.format("<ROSE>%s <N>: <ROSE>%s <N>| ", player, count[player]["counter"])
  52. ui.addTextArea(1, stringe, nil, 5, 30, 795, 20, 0x212121, 0xED67EA, 0.6, true)
  53. end
  54. if captured == #X then
  55. for x in pairs(count) do
  56. for y in pairs(count) do
  57. if count[x]["counter"] > count[y]["counter"] then
  58. tfm.exec.setUIMapName(string.format("<ROSE>[!]<N> Todas as luzes foram capturadas! <ROSE>Vencedor: <N>%s <P",x))
  59. end
  60. end
  61. end
  62. timing = timing+0.5
  63. if timing == 5 then
  64. tfm.exec.newGame(MAPS[math.random(#MAPS)])
  65. end
  66. end
  67. end
  68. end
  69.  
  70. function eventNewPlayer(name)
  71. count[name]={["counter"]=0;}
  72. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement