whiplk

Count down

Feb 23rd, 2012
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.63 KB | None | 0 0
  1. //Contagem regressiva, by Stewie`
  2. #include <a_samp>
  3.  
  4. new
  5.     COUNT_TIME,
  6.     COUNT_INDEX;
  7.    
  8. main() {
  9.     return 1;
  10. }
  11.  
  12. public OnPlayerSpawn(playerid) {
  13.     Contar(20);
  14.     return 1;
  15. }
  16.  
  17. stock Contar(segundos) {
  18.  
  19.     if(COUNT_TIME)
  20.         return false;
  21.        
  22.     COUNT_INDEX = segundos;
  23.     return (COUNT_TIME = SetTimer("Loop", 1000, true));
  24. }
  25.  
  26. forward Loop();
  27. public Loop() {
  28.     if(COUNT_INDEX == -1) {
  29.         SendClientMessageToAll(-1, "Vai Vai!");
  30.  
  31.         KillTimer(COUNT_TIME);
  32.         COUNT_TIME = 0;
  33.         return 1;
  34.     }
  35.     new msg[60];
  36.     format(msg, sizeof(msg), "Contagem: %d", COUNT_INDEX);
  37.     SendClientMessageToAll(-1, msg);
  38.     COUNT_INDEX --;
  39.     return 1;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment