SwiZzoR

Untitled

Apr 24th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.26 KB | None | 0 0
  1. #if defined _timertd_included
  2.         #endinput
  3. #endif
  4. #define _timertd_included
  5.  
  6. #include <a_samp>
  7.  
  8. #define PosX 0
  9. #define PosY 0
  10.  
  11. enum Data_TD
  12. {
  13.         Text:TD,
  14.         timer,
  15.         ForWhoShow,
  16.         t_string[128],
  17. };
  18. new STD[MAX_PLAYERS+1][Data_TD];
  19.  
  20. stock TimerTextDraw(time,ForWho) // to all write in ForWho 500
  21. {
  22.         if(ForWho <=500)
  23.         {
  24.                 format(STD[ForWho][t_string], 128, "%02d:%02d", time > 59 ? ( time / 60 ) : ( 00 ) , time  > 59 ? ( time % 60 ) : ( time ) );
  25.             STD[ForWho][TD] = TextDrawCreate(PosX,PosY,STD[ForWho][t_string]);
  26.             STD[ForWho][timer] = time;
  27.             STD[ForWho][ForWhoShow] = ForWho;
  28.             SetTimerEx("UpdateTimer", 1000, false, "d","d", time, ForWho);
  29.         }
  30.         return 1;
  31. }
  32.  
  33. forward UpdateTimer(time, ForWho);
  34. public UpdateTimer(time, ForWho)
  35. {
  36.         if(time == 0) return TextDrawDestroy(STD[ForWho][TD]);
  37.         else if( time > 0 )
  38.         {
  39.                 switch(ForWho)
  40.                 {
  41.                     case 0 .. 499 :
  42.                         {
  43.                                 STD[ForWho][timer] --;
  44.                             TextDrawHideForPlayer(STD[ForWho][ForWhoShow],STD[ForWho][TD]);
  45.                                 format(STD[ForWho][t_string], 128, "%02d:%02d", time > 59 ? ( time / 60 ) : ( 00 ) , time  > 59 ? ( time % 60 ) : ( time ) );
  46.                                 TextDrawSetString(STD[ForWho][TD],STD[ForWho][t_string]);
  47.                                 TextDrawShowForPlayer(STD[ForWho][ForWhoShow], STD[ForWho][TD]);
  48.                         }
  49.                     case 500 :
  50.                         {
  51.                             STD[ForWho][timer] --;
  52.                                 TextDrawHideForAll(STD[ForWho][TD]);
  53.                                 format(STD[ForWho][t_string], 128, "%02d:%02d", time > 59 ? ( time / 60 ) : ( 00 ) , time  > 59 ? ( time % 60 ) : ( time ) );
  54.                                 TextDrawSetString(STD[ForWho][TD],STD[ForWho][t_string]);
  55.                                 TextDrawShowForAll(STD[ForWho][TD]);
  56.                         }
  57.                 }
  58.         return SetTimerEx("UpdateTimer", 1000, false, "d","d", STD[ForWho][timer], STD[ForWho][ForWhoShow]);
  59.         }
  60.         return 1;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment