Advertisement
Eshkation-

Capture as luzes!

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