Advertisement
Hpassospi

[#Racinrun] Racinrun

Mar 25th, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5.  
  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","@4843601"}
  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.  
  101. function eventTextAreaCallback(id, player, link)
  102. if link == "Ajuda" then
  103. 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 Idulo dos Seus amigos e uma Simples Corrida <R>Correr Caso queira Morrer utilize /mort</br</p>",player,250,100,400,200,1,1,0.9,true)
  104. end
  105. if link == "Ajuda" then
  106. if id == 1 then
  107. ui.removeTextArea(1,player)
  108. end
  109. end
  110. end
  111. function eventLoop(tempoPassado, tempoFaltando)
  112. if vivo == 0 or tempoFaltando < 1000 then
  113. nextRound();
  114. end
  115. end
  116.  
  117. nextRound();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement