Advertisement
Dudugz-Contistente

Untitled

Oct 22nd, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.46 KB | None | 0 0
  1. lifes = 0
  2. deads = 0
  3.  
  4. tfm.exec.disableAutoShaman(true)
  5. tfm.exec.disableAutoNewGame(true)
  6. tfm.exec.disableAfkDeath(true)
  7. tfm.exec.disableAutoTimeLeft(true)
  8. tfm.exec.newGame('<C><P F="2" /><Z><S><S L="155" H="58" X="77" Y="115" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" X="420" H="58" Y="197" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" H="58" X="723" Y="110" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" X="723" H="58" Y="372" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" H="58" X="77" Y="372" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" H="58" X="418" Y="372" T="0" P="0,0,0.3,0.2,0,0,0,0" /></S><D><P P="0,1" Y="344" T="47" X="77" /><P P="0,0" Y="343" T="46" X="14" /><P X="726" Y="349" T="47" P="0,0" /><P P="0,0" Y="341" T="46" X="787" /><F Y="339" X="412" /><T Y="86" X="77" /></D><O /></Z></C>')
  9. ui.setMapName("<CS>[Sobrevivite]</CS> <BL>|</BL> <N>Ratos Vivos : <V>"..lifes.."</V></N> <BL>|</BL> <N>Ratos Mortos : <V>"..deads.."</V>")
  10.  
  11. p = {}
  12. data = {}
  13. remove = {}
  14. spawn = os.time();
  15. vivos = 0;
  16.  
  17.  
  18. getPlayersWin=function()
  19. local wins = {}
  20.  
  21. for name in pairs(tfm.get.room.playerList) do
  22. table.insert(wins,data[name].wins)
  23. end
  24.  
  25. return wins
  26. end
  27.  
  28. getPlayersInRoom=function()
  29. local names = {}
  30.  
  31. for name in pairs(tfm.get.room.playerList) do
  32. table.insert(names,name)
  33. end
  34.  
  35. return names
  36. end
  37.  
  38. function eventNewPlayer(name)
  39. table.insert(p,name)
  40. data[name] = (data[name] and data[name] or {
  41. wins = 0,
  42. spawn = 0,
  43. })
  44.  
  45. ui.addTextArea(0,"<font color='#FFFFFF'>Jogadores/Pontos : \n<VI>"..table.concat(getPlayersInRoom(), '\n').."</VI> = <font color='#FFD100'>"..table.concat(getPlayersWIN(), '\n').."",nil,680,28,115,0,0x153139,0x132C33,1,true)
  46. for keys, k in pairs({0,1,2,3,32,17,69}) do
  47. tfm.exec.bindKeyboard(name,k,true,true)
  48. end
  49. end
  50.  
  51. function eventNewGame()
  52. lifes = 0
  53. deads = 0
  54. ui.setMapName("<CS>[Sobrevivite]</CS> <BL>|</BL> <N>Ratos Vivos : <V>"..lifes.."</V></N> <BL>|</BL> <N>Ratos Mortos : <V>"..deads.."</V>")
  55. end
  56.  
  57.  
  58. function eventLoop(t,r)
  59. for i,v in ipairs(remove) do
  60. if v.time <= os.time()-3000 then
  61. tfm.exec.removeObject(v.cn)
  62. table.remove(remove, i)
  63. end
  64. end
  65. if r <= 0 then
  66. tfm.exec.newGame('<C><P F="2" /><Z><S><S L="155" H="58" X="77" Y="115" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" X="420" H="58" Y="197" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" H="58" X="723" Y="110" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" X="723" H="58" Y="372" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" H="58" X="77" Y="372" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" H="58" X="418" Y="372" T="0" P="0,0,0.3,0.2,0,0,0,0" /></S><D><P P="0,1" Y="344" T="47" X="77" /><P P="0,0" Y="343" T="46" X="14" /><P X="726" Y="349" T="47" P="0,0" /><P P="0,0" Y="341" T="46" X="787" /><F Y="339" X="412" /><T Y="86" X="77" /></D><O /></Z></C>')
  67. end
  68. end
  69.  
  70. function eventPlayerDied(name)
  71. vivos=vivos-1;
  72. deads = deads + 1
  73. lifes = lifes - 1
  74. ui.setMapName("<CS>[Sobrevivite]</CS> <BL>|</BL> <N>Ratos Vivos : <V>"..lifes.."</V></N> <BL>|</BL> <N>Ratos Mortos : <V>"..deads.."</V>")
  75. local a = 0
  76. for i,v in pairs(tfm.get.room.playerList) do
  77. if not v.isDead then
  78. a = a + 1
  79. end
  80. end
  81. if a < 1 then
  82. tfm.exec.newGame('<C><P F="2" /><Z><S><S L="155" H="58" X="77" Y="115" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" X="420" H="58" Y="197" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" H="58" X="723" Y="110" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" X="723" H="58" Y="372" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" H="58" X="77" Y="372" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" H="58" X="418" Y="372" T="0" P="0,0,0.3,0.2,0,0,0,0" /></S><D><P P="0,1" Y="344" T="47" X="77" /><P P="0,0" Y="343" T="46" X="14" /><P X="726" Y="349" T="47" P="0,0" /><P P="0,0" Y="341" T="46" X="787" /><F Y="339" X="412" /><T Y="86" X="77" /></D><O /></Z></C>')
  83. end
  84. end
  85.  
  86. function eventPlayerWon(name)
  87. vivos=vivos-1;
  88. data[name].wins = data[name].wins + 1
  89. ui.addTextArea(0,"<font color='#FFFFFF'>Jogadores/Pontos : \n<VI>★"..table.concat(p, '\n').."</VI> = <font color='#FFD100'>"..data[nome].wins.."",nil,680,28,115,0,0x153139,0x132C33,1,true)
  90. if vivos < 1 then
  91. tfm.exec.newGame('<C><P F="2" /><Z><S><S L="155" H="58" X="77" Y="115" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" X="420" H="58" Y="197" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" H="58" X="723" Y="110" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" X="723" H="58" Y="372" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" H="58" X="77" Y="372" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S L="155" H="58" X="418" Y="372" T="0" P="0,0,0.3,0.2,0,0,0,0" /></S><D><P P="0,1" Y="344" T="47" X="77" /><P P="0,0" Y="343" T="46" X="14" /><P X="726" Y="349" T="47" P="0,0" /><P P="0,0" Y="341" T="46" X="787" /><F Y="339" X="412" /><T Y="86" X="77" /></D><O /></Z></C>')
  92. end
  93. end
  94.  
  95. function eventKeyboard(name, key, down, x, y)
  96. tfm.get.room.playerList[name].x = x
  97. tfm.get.room.playerList[name].y = y
  98.  
  99. if (key == 2) then
  100. tfm.get.room.playerList[name].isFacingRight = true
  101. elseif (key == 0) then
  102. tfm.get.room.playerList[name].isFacingRight = false
  103. elseif (key == 3) and not tfm.get.room.playerList[name].isDead then
  104. if data[name].spawn < os.time()-5000 then
  105. local obj
  106. if tfm.get.room.playerList[name].isFacingRight then
  107. obj = tfm.exec.addShamanObject(17,x+2,y+8,90)
  108. else
  109. obj = tfm.exec.addShamanObject(17,x-2,y+8,-90)
  110. end
  111. table.insert(remove, {time=os.time(),cn=obj})
  112.  
  113. data[name].spawn = os.time();
  114. end
  115. end
  116. end
  117.  
  118. for all in pairs(tfm.get.room.playerList) do
  119. eventNewPlayer(all)
  120. tfm.exec.giveMeep(all)
  121. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement