Advertisement
Hpassospi

[#Racinrun] #Racinrun 2

Mar 25th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. red={}
  2. blue={}
  3. function makeTeams()
  4. local playerList={}
  5. for name,player in pairs(tfm.get.room.playerList) do
  6. table.insert(playerList,name)
  7. end
  8. for i=1,#playerList,1 do
  9. local index=math.random(#playerList)
  10. local name=playerList[index]
  11. if i%2==0 then
  12. table.insert(red,name)
  13. else
  14. table.insert(blue,name)
  15. end
  16. table.remove(playerList,index)
  17. end
  18. end
  19.  
  20. makeTeams()
  21. ranking={};
  22.  
  23. function estaNaTabela(player)
  24. for i = #ranking,1,-1 do
  25. if ranking == player then
  26. return true;
  27. end
  28. end
  29. return false;
  30. end
  31.  
  32. function verRanking(player)
  33. for i = #ranking,1,-1 do
  34. table.remove(ranking,i)
  35. end
  36. for i = 0,3 do
  37. local score = -1;
  38. local pl = nil;
  39. for p,v in pairs(tfm.get.room.playerList) do
  40. if v.score > score and not estaNaTabela(p) then
  41. score=v.score;
  42. pl=p;
  43. end
  44. end
  45. table.insert(ranking,pl)
  46. end
  47. for i = #ranking,1,-1 do
  48. print(ranking)
  49. end
  50. end
  51.  
  52. verRanking()
  53.  
  54. tfm.exec.disableAutoNewGame(true)
  55. ui.addTextArea(3,"<p align='center'><a href='event:Ajuda'>Ajuda</a></p>",NIL,650,20,145,20,1,1,0.5,true)
  56.  
  57. -- Mapas
  58. mapas={"0","2","1"}
  59.  
  60. -- Nova rounda
  61. function nextRound()
  62. tfm.exec.newGame(mapas[math.random(#mapas)])
  63. end
  64.  
  65. -- Novo jogo
  66. function eventNewGame()
  67. vivo=0
  68. for name,player in pairs(tfm.get.room.playerList) do
  69. vivo=vivo+1
  70. end
  71. tfm.exec.setUIMapName("RaciRun" )
  72. for i in pairs(tfm.get.room.playerList) do
  73. end
  74. end
  75.  
  76. -- Jogador morre
  77. function eventPlayerDied(name)
  78. vivo=vivo-1
  79. end
  80.  
  81. -- Jogador ganha
  82. function eventPlayerWon(name)
  83. vivo=vivo-1
  84. end
  85.  
  86. -- Nova ronda
  87. nextRound();
  88.  
  89. --CallBack
  90.  
  91. function eventTextAreaCallback(id, player, link)
  92. if link == "Ajuda" then
  93. 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 Correr </br</p>",player,250,100,400,200,1,1,0.9,true)
  94. end
  95. if link == "Ajuda" then
  96. if id == 1 then
  97. ui.removeTextArea(1,player)
  98. end
  99. end
  100. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement