Advertisement
Sky_Softh

Loop ^^

Feb 10th, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. //variavel responsavรฉl pelo numero de Players :)
  2. new MaiorID;
  3.  
  4. //Callback que faz a contagem de players
  5. forward CountPlayers();
  6. public CountPlayers()
  7. {
  8. new
  9. Players,
  10. IdCounter
  11. ;
  12. for(new i = 0; i < MaiorID; i++){
  13. if(IsPlayerConnected(i)){
  14. Players++;
  15. if(i > IdCounter){
  16. IdCounter = i;
  17. }
  18. }
  19. }
  20. MaiorID = (Players+3);
  21.  
  22. return Players;
  23. }
  24.  
  25. //teste
  26.  
  27. /*
  28.  
  29. vocรช pode tanto usar as loops comuns ou essa Loop fazendo o seguinte :
  30.  
  31. for(new i = 0; i < MaiorID; i++){
  32. }
  33.  
  34. */
  35.  
  36. //Ongamemodeinit
  37. MaiorID = MAX_PLAYERS; // da um valor inicial a variavel ..
  38. SetTimer("CountPlayers", 2000, true); //Timer para reposicionar o valor da variavel e deixala sempre leve
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement