Advertisement
Novohp

[Lua] #RacinRun 1.22

May 6th, 2015
491
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.71 KB | None | 0 0
  1. tfm.exec.disableAutoShaman(true)
  2. tfm.exec.disableAutoNewGame(true)
  3. function eventPlayerDied(playerName)
  4. tfm.exec.respawnPlayer(playerName)
  5. end
  6. tfm.exec.disableAfkDeath(true)
  7. function eventChatCommand(p,cm)
  8. if cm == [[mort]] then
  9. tfm.exec.killPlayer(p)
  10. end
  11. end
  12. red={}
  13. blue={}
  14. function makeTeams()
  15. local playerList={}
  16. for name,player in pairs(tfm.get.room.playerList) do
  17. table.insert(playerList,name)
  18. end
  19. for i=1,#playerList,1 do
  20. local index=math.random(#playerList)
  21. local name=playerList[index]
  22. if i%2==0 then
  23. table.insert(red,name)
  24. else
  25. table.insert(blue,name)
  26. end
  27. table.remove(playerList,index)
  28. end
  29. end
  30.  
  31. makeTeams()
  32. ranking={};
  33.  
  34. function estaNaTabela(player)
  35. for i = #ranking,1,-1 do
  36. if ranking == player then
  37. return true;
  38. end
  39. end
  40. return false;
  41. end
  42.  
  43. function verRanking(player)
  44. for i = #ranking,1,-1 do
  45. table.remove(ranking,i)
  46. end
  47. for i = 0,3 do
  48. local score = -1;
  49. local pl = nil;
  50. for p,v in pairs(tfm.get.room.playerList) do
  51. if v.score > score and not estaNaTabela(p) then
  52. score=v.score;
  53. pl=p;
  54. end
  55. end
  56. table.insert(ranking,pl)
  57. end
  58. for i = #ranking,1,-1 do
  59. print(ranking)
  60. end
  61. end
  62.  
  63. verRanking()
  64.  
  65.  
  66.  
  67. -- Mapas
  68. mapas={"@4953687","@5032745","@1979131","@260384","@5650267","@229827","@161730","@3638794","@1856349","@4238784","@4148332","@210188","@1368233 ","@214660","@1525272","@1637638 ","@327130","@556426","@208914"}
  69.  
  70. -- Nova rounda
  71. function nextRound()
  72. tfm.exec.newGame(mapas[math.random(#mapas)])
  73. end
  74.  
  75. -- Novo jogo
  76. function eventNewGame()
  77. vivo=0
  78. for name,player in pairs(tfm.get.room.playerList) do
  79. vivo=vivo+1
  80. end
  81. tfm.exec.setUIMapName("RaciRun" )
  82. for i in pairs(tfm.get.room.playerList) do
  83. end
  84. end
  85.  
  86. -- Jogador morre
  87. function eventPlayerDied(name)
  88. vivo=vivo-1
  89. end
  90.  
  91. -- Jogador ganha
  92. function eventPlayerWon(name)
  93. vivo=vivo-1
  94. end
  95.  
  96. -- Nova ronda
  97. nextRound();
  98.  
  99. function eventLoop(tempoPassado, tempoFaltando)
  100. if vivo == 0 or tempoFaltando < 1000 then
  101. nextRound();
  102. end
  103. end
  104. ui.addTextArea(0,"<font color='#855924' align='center' size='20'><b>     <i><s>     #RacinRun </s></i></font><font size='26' color='#855924' align='center' face='Soopafresh'><br>          <font face='arial' size='12'><br><b><J><br><br><b><font size='14'>Olá pessoal bem-vindos ao <N>#RacinRun</N>. Digitem <N>H</N> para mais informações! <R>Obs.: O H ainda não funciona</R> <R>  <j>  <V>  <br><br><ch><font size='12'><j>",playerName,200,125,380,170, 0x3E3D3C, 0xF9E1AF, 0.8, true)
  105. ui.addTextArea(1,"<p align='center'><font color='#855924'><B><a href='event:close'>X</a>",player,568,112,19,18,0xFF4100,0x313131,1,true)
  106. function eventTextAreaCallback(textAreaId, player, callback)
  107. if(callback == "close") then
  108. ui.removeTextArea(0,player)
  109. ui.removeTextArea(1,player)
  110. end
  111. end
  112. nextRound();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement