Tectoon

[TFM] RacingRun

Jun 19th, 2015
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.42 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. function eventChatCommand(p,cm)
  7. if cm == [[mort]] then
  8. tfm.exec.killPlayer(p)
  9. end
  10. end
  11. red={}
  12. blue={}
  13. function makeTeams()
  14. local playerList={}
  15. for name,player in pairs(tfm.get.room.playerList) do
  16. table.insert(playerList,name)
  17. end
  18. for i=1,#playerList,1 do
  19. local index=math.random(#playerList)
  20. local name=playerList[index]
  21. if i%2==0 then
  22. table.insert(red,name)
  23. else
  24. table.insert(blue,name)
  25. end
  26. table.remove(playerList,index)
  27. end
  28. end
  29.  
  30. makeTeams()
  31. ranking={};
  32.  
  33. function estaNaTabela(player)
  34. for i = #ranking,1,-1 do
  35. if ranking == player then
  36. return true;
  37. end
  38. end
  39. return false;
  40. end
  41.  
  42. function verRanking(player)
  43. for i = #ranking,1,-1 do
  44. table.remove(ranking,i)
  45. end
  46. for i = 0,3 do
  47. local score = -1;
  48. local pl = nil;
  49. for p,v in pairs(tfm.get.room.playerList) do
  50. if v.score > score and not estaNaTabela(p) then
  51. score=v.score;
  52. pl=p;
  53. end
  54. end
  55. table.insert(ranking,pl)
  56. end
  57. for i = #ranking,1,-1 do
  58. print(ranking)
  59. end
  60. end
  61.  
  62. verRanking()
  63.  
  64. tfm.exec.disableAutoNewGame(true)
  65. ui.addTextArea(3,"<p align='center'><a href='event:Ajuda'>Ajuda</a></p>",NIL,650,20,145,20,1,1,0.5,true)
  66.  
  67. -- Mapas
  68. mapas={"@4953687","@5032745","@1979131","@5650267","@229827","@161730","@3638794","@1856349","@4238784","@4148332","@210188","@1368233 ","@214660"}
  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. --CallBack
  100.  function eventTextAreaCallback(id, player, link)
  101. if link == "Ajuda" then
  102. ui.addTextArea(1,"<p align='center'><br><br><a href='event:fechar'>(fechar)</a></br><br>Bem vindo ao RaciRun!!! Corra para Vencer e ser O Ídolo dos seus amigos e uma simples Corrida <R > Caso queira Morrer utilize /mort</br</p>",player,250,100,400,200,1,1,0.9,true)
  103. end
  104. if link == "fechar" then
  105. if id == 1 then
  106. ui.removeTextArea(1,player)
  107. end
  108. end
  109. end
  110. function eventLoop(tempoPassado, tempoFaltando)
  111. if vivo == 0 or tempoFaltando < 1000 then
  112. nextRound();
  113. end
  114. end
  115.  
  116. nextRound();
Advertisement
Add Comment
Please, Sign In to add comment