SwiZzoR

Untitled

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