Advertisement
Guest User

2011

a guest
Dec 31st, 2010
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.74 KB | None | 0 0
  1. #include <a_samp>
  2. new cTime;
  3. new Text:NYCounter;
  4. new Text:HappyNewYearText;
  5.  
  6. public OnFilterScriptInit()
  7. {
  8.     NYCounter = TextDrawCreate(357.000000, 399.000000, "_");
  9.     TextDrawAlignment(NYCounter, 2);
  10.     TextDrawBackgroundColor(NYCounter, 255);
  11.     TextDrawFont(NYCounter, 2);
  12.     TextDrawLetterSize(NYCounter, 0.500000, 2.599999);
  13.     TextDrawColor(NYCounter, -16776961);
  14.     TextDrawSetOutline(NYCounter, 1);
  15.     TextDrawSetProportional(NYCounter, 1);
  16.  
  17.     HappyNewYearText = TextDrawCreate(340.000000, 350.000000, "~>~ HAPPY NEW YEAR ~<~~n~~y~2011!");
  18.     TextDrawAlignment(HappyNewYearText, 2);
  19.     TextDrawBackgroundColor(HappyNewYearText, 255);
  20.     TextDrawFont(HappyNewYearText, 1);
  21.     TextDrawLetterSize(HappyNewYearText, 1.000000, 4.000000);
  22.     TextDrawColor(HappyNewYearText, 16777215);
  23.     TextDrawSetOutline(HappyNewYearText, 1);
  24.     TextDrawSetProportional(HappyNewYearText, 1);
  25.  
  26.     CounterTimer();
  27.     cTime = SetTimer("CounterTimer", 400, 1);
  28.     return 1;
  29. }
  30.  
  31. public OnFilterScriptExit()
  32. {
  33.     TextDrawDestroy(NYCounter);
  34.     TextDrawDestroy(HappyNewYearText);
  35.     KillTimer(cTime);
  36. }
  37.  
  38. public OnPlayerConnect(playerid)
  39. {
  40.     new year, month, day, hour, minute, second;
  41.     getdate(year, month, day);
  42.     gettime(hour, minute, second);
  43.     if(day >= 1 && month >= 1 && (second > 0 || hour > 0))
  44.     {
  45.         TextDrawShowForPlayer(playerid, HappyNewYearText);
  46.     }
  47. }
  48.  
  49. forward CounterTimer();
  50. public CounterTimer()
  51. {
  52.     new string[256], hstring[256], mstring[256], sstring[256];
  53.     new year, month, day, hour, minute, second;
  54.     getdate(year, month, day);
  55.     gettime(hour, minute, second);
  56.     if((month == 12 && day == 31) || (day == 1 && month == 1 && minute == 0 && hour == 0 && second == 0 ))
  57.     {
  58.         gettime(hour, minute, second);
  59.         hour = 24 - hour;
  60.         if(minute != 0) { hour--; }
  61.        
  62.         minute = 60 - minute;
  63.         if(second != 0) { minute--; }
  64.         if(minute == 60) { minute = 0; }
  65.        
  66.         second = 60 - second;
  67.         if(second == 60) { second = 0; }
  68.        
  69.         if(hour < 10) { format(hstring, sizeof(hstring), "0%d", hour); } else { format(hstring, sizeof(hstring), "%d", hour); }
  70.         if(minute < 10) { format(mstring, sizeof(mstring), "0%d", minute); } else { format(mstring, sizeof(mstring), "%d", minute); }
  71.         if(second < 10) { format(sstring, sizeof(sstring), "0%d", second); } else { format(sstring, sizeof(sstring), "%d", second); }
  72.         format(string, sizeof(string), "~r~~h~%s~w~~h~:~r~~h~%s~w~~h~:~r~~h~%s", hstring, mstring, sstring);
  73.         TextDrawHideForAll(NYCounter);
  74.         TextDrawSetString(NYCounter, string);
  75.         TextDrawShowForAll(NYCounter);
  76.     }
  77.     else if(day >= 1 && month == 1 && (second > 0 || hour > 0))
  78.     {
  79.         for(new i; i < MAX_PLAYERS; i++) { PlayerPlaySound(i, 1147, 0, 0, 0); }
  80.         TextDrawHideForAll(NYCounter);
  81.         TextDrawShowForAll(HappyNewYearText);
  82.         KillTimer(cTime);
  83.     }
  84.     return 1;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement