Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- new cTime;
- new Text:NYCounter;
- new Text:HappyNewYearText;
- public OnFilterScriptInit()
- {
- NYCounter = TextDrawCreate(357.000000, 399.000000, "_");
- TextDrawAlignment(NYCounter, 2);
- TextDrawBackgroundColor(NYCounter, 255);
- TextDrawFont(NYCounter, 2);
- TextDrawLetterSize(NYCounter, 0.500000, 2.599999);
- TextDrawColor(NYCounter, -16776961);
- TextDrawSetOutline(NYCounter, 1);
- TextDrawSetProportional(NYCounter, 1);
- HappyNewYearText = TextDrawCreate(340.000000, 350.000000, "~>~ HAPPY NEW YEAR ~<~~n~~y~2011!");
- TextDrawAlignment(HappyNewYearText, 2);
- TextDrawBackgroundColor(HappyNewYearText, 255);
- TextDrawFont(HappyNewYearText, 1);
- TextDrawLetterSize(HappyNewYearText, 1.000000, 4.000000);
- TextDrawColor(HappyNewYearText, 16777215);
- TextDrawSetOutline(HappyNewYearText, 1);
- TextDrawSetProportional(HappyNewYearText, 1);
- CounterTimer();
- cTime = SetTimer("CounterTimer", 400, 1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- TextDrawDestroy(NYCounter);
- TextDrawDestroy(HappyNewYearText);
- KillTimer(cTime);
- }
- public OnPlayerConnect(playerid)
- {
- new year, month, day, hour, minute, second;
- getdate(year, month, day);
- gettime(hour, minute, second);
- if(day >= 1 && month >= 1 && (second > 0 || hour > 0))
- {
- TextDrawShowForPlayer(playerid, HappyNewYearText);
- }
- }
- forward CounterTimer();
- public CounterTimer()
- {
- new string[256], hstring[256], mstring[256], sstring[256];
- new year, month, day, hour, minute, second;
- getdate(year, month, day);
- gettime(hour, minute, second);
- if((month == 12 && day == 31) || (day == 1 && month == 1 && minute == 0 && hour == 0 && second == 0 ))
- {
- gettime(hour, minute, second);
- hour = 24 - hour;
- if(minute != 0) { hour--; }
- minute = 60 - minute;
- if(second != 0) { minute--; }
- if(minute == 60) { minute = 0; }
- second = 60 - second;
- if(second == 60) { second = 0; }
- if(hour < 10) { format(hstring, sizeof(hstring), "0%d", hour); } else { format(hstring, sizeof(hstring), "%d", hour); }
- if(minute < 10) { format(mstring, sizeof(mstring), "0%d", minute); } else { format(mstring, sizeof(mstring), "%d", minute); }
- if(second < 10) { format(sstring, sizeof(sstring), "0%d", second); } else { format(sstring, sizeof(sstring), "%d", second); }
- format(string, sizeof(string), "~r~~h~%s~w~~h~:~r~~h~%s~w~~h~:~r~~h~%s", hstring, mstring, sstring);
- TextDrawHideForAll(NYCounter);
- TextDrawSetString(NYCounter, string);
- TextDrawShowForAll(NYCounter);
- }
- else if(day >= 1 && month == 1 && (second > 0 || hour > 0))
- {
- for(new i; i < MAX_PLAYERS; i++) { PlayerPlaySound(i, 1147, 0, 0, 0); }
- TextDrawHideForAll(NYCounter);
- TextDrawShowForAll(HappyNewYearText);
- KillTimer(cTime);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement