Guest User

aWeather - [XST]O_x

a guest
Aug 9th, 2014
984
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 19.15 KB | None | 0 0
  1. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  3. //######################################################### Advanced Weather and Forecast System ##########################################################
  4. //##################################################################### Version 1.03a  ####################################################################
  5. //##################################################################### By [XST]O_x   #####################################################################
  6. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  7. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  8.  
  9. ///////////////////////////////////////////////////////////////////////////Credits/////////////////////////////////////////////////////////////////////////
  10.  
  11. /*
  12. Zeex            -   zcmd
  13. [MM]RoXoR[FS]   -   tdgroups.inc
  14. iPLE0MAX        -   His amazing textdraw editor
  15. Y_Less          -   foreach
  16. */
  17.  
  18. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  19.  
  20. ///////////////////////////////////////////////////////////////////////////Includes////////////////////////////////////////////////////////////////////////
  21.  
  22. #include <a_samp>
  23. #include <tdgroups>
  24. #include <foreach>
  25. #include <zcmd>
  26.  
  27. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  28.  
  29. //////////////////////////////////////////////////////////////////////////Definitons///////////////////////////////////////////////////////////////////////
  30.  
  31. #define USE_CLOCK               //Comment this to hide clock
  32. #define VERSION         "1.03a"
  33.  
  34. #define PRESSED(%0) \
  35.     (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  36. #define RELEASED(%0) \
  37.     (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
  38.    
  39.    
  40. #define COLOR_PREFIX    0x93DCFFFF
  41. #define COLOR_BODY      "{CB96FC}"
  42.  
  43. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  44.  
  45. //////////////////////////////////////////////////////////////////////////Variables////////////////////////////////////////////////////////////////////////
  46.  
  47. new     Text: fc_Background                         ;
  48. new     Text: fc_DaySlot[ 7 ]                       ;
  49. new     Text: fc_Border                             ;
  50. new     Text: fc_WeatherSlot[ 7 ]                   ;
  51. new     Text: fc_Title                              ;
  52. new           tdGroup_Forecast                      ;
  53.  
  54. #if defined USE_CLOCK
  55. new     Text: fc_Clock                              ;
  56. new     Text: td_ServerDay                          ;
  57. #endif
  58.  
  59. new     weekNeedle                                  ;
  60.  
  61. new     weekWeather[ 7 ]                            ;
  62. new     nextWeekWeather[ 7 ]                        ;
  63.  
  64. new     weekDays[][]    =   {
  65.     {"Sunday"},
  66.     {"Monday"},
  67.     {"Tuesday"},
  68.     {"Wednesday"},
  69.     {"Thursday"},
  70.     {"Friday"},
  71.     {"Saturday"}
  72. }                                                   ;
  73.  
  74. new     possibleWeathers[ ][ ][ ]       =       {
  75.     {0, "Extra Sunny"},
  76.     {1, "Sunny"},
  77.     {2, "Extra Sunny with Smog"},
  78.     {3, "Sunny with Smog"},
  79.     {4, "Cloudy"},
  80.     {5, "Sunny"},
  81.     {6, "Extra Sunny"},
  82.     {7, "Cloudy"},
  83.     {8, "Rainy"},
  84.     {9, "Foggy"},
  85.     {10, "Sunny"},
  86.     {11, "Extra Sunny"},
  87.     {12, "Cloudy"},
  88.     {13, "Extra Sunny"},
  89.     {14, "Sunny"},
  90.     {15, "Cloudy"},
  91.     {16, "Rainy"},
  92.     {17, "Extra Sunny"},
  93.     {18, "Sunny"}
  94. }                                                   ;
  95.  
  96. new     timerUpdateTime                             ;
  97. new     timerWorldHours                             ;
  98. new     timerWorldMinutes                           ;
  99.  
  100. new     bool: playerWatchingForecast[ MAX_PLAYERS ] ;
  101.  
  102. forward UpdateServerTime()                          ;
  103.  
  104. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  105.  
  106. public OnFilterScriptInit()
  107. {
  108.     print("*******************************************************");
  109.     print(" ");
  110.     print("Loaded Advanced Weather and Forecast System by [XST]O_x");
  111.     print(" ");
  112.     printf("Version: %s", VERSION);
  113.     print(" ");
  114.     print("*******************************************************");
  115.    
  116.     fc_Background = TextDrawCreate(175.666687, 171.739898, "usebox");
  117.     TextDrawLetterSize(fc_Background, 0.000000, 14.797397);
  118.     TextDrawTextSize(fc_Background, -0.666666, 0.000000);
  119.     TextDrawAlignment(fc_Background, 1);
  120.     TextDrawColor(fc_Background, 65535);
  121.     TextDrawUseBox(fc_Background, true);
  122.     TextDrawBoxColor(fc_Background, 35);
  123.     TextDrawSetShadow(fc_Background, 0);
  124.     TextDrawSetOutline(fc_Background, 0);
  125.     TextDrawBackgroundColor(fc_Background, 65405);
  126.     TextDrawFont(fc_Background, 0);
  127.  
  128.     fc_DaySlot[0] = TextDrawCreate(2.000000, 176.586608, "Wednesday");
  129.     TextDrawLetterSize(fc_DaySlot[0], 0.333998, 1.499200);
  130.     TextDrawAlignment(fc_DaySlot[0], 1);
  131.     TextDrawColor(fc_DaySlot[0], -1);
  132.     TextDrawSetShadow(fc_DaySlot[0], 0);
  133.     TextDrawSetOutline(fc_DaySlot[0], 1);
  134.     TextDrawBackgroundColor(fc_DaySlot[0], 51);
  135.     TextDrawFont(fc_DaySlot[0], 1);
  136.     TextDrawSetProportional(fc_DaySlot[0], 1);
  137.  
  138.     fc_DaySlot[1] = TextDrawCreate(2.00, 194.013275, "Wednesday");
  139.     TextDrawLetterSize(fc_DaySlot[1], 0.333998, 1.499200);
  140.     TextDrawAlignment(fc_DaySlot[1], 1);
  141.     TextDrawColor(fc_DaySlot[1], -1);
  142.     TextDrawSetShadow(fc_DaySlot[1], 0);
  143.     TextDrawSetOutline(fc_DaySlot[1], 1);
  144.     TextDrawBackgroundColor(fc_DaySlot[1], 51);
  145.     TextDrawFont(fc_DaySlot[1], 1);
  146.     TextDrawSetProportional(fc_DaySlot[1], 1);
  147.  
  148.     fc_DaySlot[2] = TextDrawCreate(2.00, 211.813293, "Wednesday");
  149.     TextDrawLetterSize(fc_DaySlot[2], 0.333998, 1.499200);
  150.     TextDrawAlignment(fc_DaySlot[2], 1);
  151.     TextDrawColor(fc_DaySlot[2], -1);
  152.     TextDrawSetShadow(fc_DaySlot[2], 0);
  153.     TextDrawSetOutline(fc_DaySlot[2], 1);
  154.     TextDrawBackgroundColor(fc_DaySlot[2], 51);
  155.     TextDrawFont(fc_DaySlot[2], 1);
  156.     TextDrawSetProportional(fc_DaySlot[2], 1);
  157.  
  158.     fc_DaySlot[3] = TextDrawCreate(2.00, 230.733398, "Wednesday");
  159.     TextDrawLetterSize(fc_DaySlot[3], 0.333998, 1.499200);
  160.     TextDrawAlignment(fc_DaySlot[3], 1);
  161.     TextDrawColor(fc_DaySlot[3], -1);
  162.     TextDrawSetShadow(fc_DaySlot[3], 0);
  163.     TextDrawSetOutline(fc_DaySlot[3], 1);
  164.     TextDrawBackgroundColor(fc_DaySlot[3], 51);
  165.     TextDrawFont(fc_DaySlot[3], 1);
  166.     TextDrawSetProportional(fc_DaySlot[3], 1);
  167.  
  168.     fc_DaySlot[4] = TextDrawCreate(2.00, 250.773498, "Wednesday");
  169.     TextDrawLetterSize(fc_DaySlot[4], 0.333998, 1.499200);
  170.     TextDrawAlignment(fc_DaySlot[4], 1);
  171.     TextDrawColor(fc_DaySlot[4], -1);
  172.     TextDrawSetShadow(fc_DaySlot[4], 0);
  173.     TextDrawSetOutline(fc_DaySlot[4], 1);
  174.     TextDrawBackgroundColor(fc_DaySlot[4], 51);
  175.     TextDrawFont(fc_DaySlot[4], 1);
  176.     TextDrawSetProportional(fc_DaySlot[4], 1);
  177.  
  178.     fc_DaySlot[5] = TextDrawCreate(2.00, 271.560119, "Wednesday");
  179.     TextDrawLetterSize(fc_DaySlot[5], 0.333998, 1.499200);
  180.     TextDrawAlignment(fc_DaySlot[5], 1);
  181.     TextDrawColor(fc_DaySlot[5], -1);
  182.     TextDrawSetShadow(fc_DaySlot[5], 0);
  183.     TextDrawSetOutline(fc_DaySlot[5], 1);
  184.     TextDrawBackgroundColor(fc_DaySlot[5], 51);
  185.     TextDrawFont(fc_DaySlot[5], 1);
  186.     TextDrawSetProportional(fc_DaySlot[5], 1);
  187.  
  188.     fc_DaySlot[6] = TextDrawCreate(2.00, 290.106781, "Wednesday");
  189.     TextDrawLetterSize(fc_DaySlot[6], 0.333998, 1.499200);
  190.     TextDrawAlignment(fc_DaySlot[6], 1);
  191.     TextDrawColor(fc_DaySlot[6], -1);
  192.     TextDrawSetShadow(fc_DaySlot[6], 0);
  193.     TextDrawSetOutline(fc_DaySlot[6], 1);
  194.     TextDrawBackgroundColor(fc_DaySlot[6], 51);
  195.     TextDrawFont(fc_DaySlot[6], 1);
  196.     TextDrawSetProportional(fc_DaySlot[6], 1);
  197.  
  198.     fc_Border = TextDrawCreate(76.333335, 172.113296, "usebox");
  199.     TextDrawLetterSize(fc_Border, 0.000000, 14.749258);
  200.     TextDrawTextSize(fc_Border, 73.000000, 0.000000);
  201.     TextDrawAlignment(fc_Border, 1);
  202.     TextDrawColor(fc_Border, 0);
  203.     TextDrawUseBox(fc_Border, true);
  204.     TextDrawBoxColor(fc_Border, 102);
  205.     TextDrawSetShadow(fc_Border, 0);
  206.     TextDrawSetOutline(fc_Border, 0);
  207.     TextDrawFont(fc_Border, 0);
  208.  
  209.     fc_WeatherSlot[0] = TextDrawCreate(78.666633, 176.586608, "Extra Sunny with Smog");
  210.     TextDrawLetterSize(fc_WeatherSlot[0], 0.227333, 1.338667);
  211.     TextDrawAlignment(fc_WeatherSlot[0], 1);
  212.     TextDrawColor(fc_WeatherSlot[0], -1);
  213.     TextDrawSetShadow(fc_WeatherSlot[0], 0);
  214.     TextDrawSetOutline(fc_WeatherSlot[0], 1);
  215.     TextDrawBackgroundColor(fc_WeatherSlot[0], 51);
  216.     TextDrawFont(fc_WeatherSlot[0], 1);
  217.     TextDrawSetProportional(fc_WeatherSlot[0], 1);
  218.  
  219.     fc_WeatherSlot[1] = TextDrawCreate(78.666633, 194.013275, "Extra Sunny with Smog");
  220.     TextDrawLetterSize(fc_WeatherSlot[1], 0.227333, 1.338667);
  221.     TextDrawAlignment(fc_WeatherSlot[1], 1);
  222.     TextDrawColor(fc_WeatherSlot[1], -1);
  223.     TextDrawSetShadow(fc_WeatherSlot[1], 0);
  224.     TextDrawSetOutline(fc_WeatherSlot[1], 1);
  225.     TextDrawBackgroundColor(fc_WeatherSlot[1], 51);
  226.     TextDrawFont(fc_WeatherSlot[1], 1);
  227.     TextDrawSetProportional(fc_WeatherSlot[1], 1);
  228.  
  229.     fc_WeatherSlot[2] = TextDrawCreate(78.666633, 211.813293, "Extra Sunny with Smog");
  230.     TextDrawLetterSize(fc_WeatherSlot[2], 0.227333, 1.338667);
  231.     TextDrawAlignment(fc_WeatherSlot[2], 1);
  232.     TextDrawColor(fc_WeatherSlot[2], -1);
  233.     TextDrawSetShadow(fc_WeatherSlot[2], 0);
  234.     TextDrawSetOutline(fc_WeatherSlot[2], 1);
  235.     TextDrawBackgroundColor(fc_WeatherSlot[2], 51);
  236.     TextDrawFont(fc_WeatherSlot[2], 1);
  237.     TextDrawSetProportional(fc_WeatherSlot[2], 1);
  238.  
  239.     fc_WeatherSlot[3] = TextDrawCreate(78.666633, 230.733398, "Extra Sunny with Smog");
  240.     TextDrawLetterSize(fc_WeatherSlot[3], 0.227333, 1.338667);
  241.     TextDrawAlignment(fc_WeatherSlot[3], 1);
  242.     TextDrawColor(fc_WeatherSlot[3], -1);
  243.     TextDrawSetShadow(fc_WeatherSlot[3], 0);
  244.     TextDrawSetOutline(fc_WeatherSlot[3], 1);
  245.     TextDrawBackgroundColor(fc_WeatherSlot[3], 51);
  246.     TextDrawFont(fc_WeatherSlot[3], 1);
  247.     TextDrawSetProportional(fc_WeatherSlot[3], 1);
  248.  
  249.     fc_WeatherSlot[4] = TextDrawCreate(78.666633, 250.773498, "Extra Sunny with Smog");
  250.     TextDrawLetterSize(fc_WeatherSlot[4], 0.227333, 1.338667);
  251.     TextDrawAlignment(fc_WeatherSlot[4], 1);
  252.     TextDrawColor(fc_WeatherSlot[4], -1);
  253.     TextDrawSetShadow(fc_WeatherSlot[4], 0);
  254.     TextDrawSetOutline(fc_WeatherSlot[4], 1);
  255.     TextDrawBackgroundColor(fc_WeatherSlot[4], 51);
  256.     TextDrawFont(fc_WeatherSlot[4], 1);
  257.     TextDrawSetProportional(fc_WeatherSlot[4], 1);
  258.  
  259.     fc_WeatherSlot[5] = TextDrawCreate(78.666633, 271.560119, "Extra Sunny with Smog");
  260.     TextDrawLetterSize(fc_WeatherSlot[5], 0.227333, 1.338667);
  261.     TextDrawAlignment(fc_WeatherSlot[5], 1);
  262.     TextDrawColor(fc_WeatherSlot[5], -1);
  263.     TextDrawSetShadow(fc_WeatherSlot[5], 0);
  264.     TextDrawSetOutline(fc_WeatherSlot[5], 1);
  265.     TextDrawBackgroundColor(fc_WeatherSlot[5], 51);
  266.     TextDrawFont(fc_WeatherSlot[5], 1);
  267.     TextDrawSetProportional(fc_WeatherSlot[5], 1);
  268.  
  269.     fc_WeatherSlot[6] = TextDrawCreate(78.666633, 290.106781, "Extra Sunny with Smog");
  270.     TextDrawLetterSize(fc_WeatherSlot[6], 0.227333, 1.338667);
  271.     TextDrawAlignment(fc_WeatherSlot[6], 1);
  272.     TextDrawColor(fc_WeatherSlot[6], -1);
  273.     TextDrawSetShadow(fc_WeatherSlot[6], 0);
  274.     TextDrawSetOutline(fc_WeatherSlot[6], 1);
  275.     TextDrawBackgroundColor(fc_WeatherSlot[6], 51);
  276.     TextDrawFont(fc_WeatherSlot[6], 1);
  277.     TextDrawSetProportional(fc_WeatherSlot[6], 1);
  278.  
  279.     fc_Title = TextDrawCreate(2.666667, 153.813446, "Weather Forecast");
  280.     TextDrawLetterSize(fc_Title, 0.449999, 1.600000);
  281.     TextDrawAlignment(fc_Title, 1);
  282.     TextDrawColor(fc_Title, -1378294017);
  283.     TextDrawSetShadow(fc_Title, 0);
  284.     TextDrawSetOutline(fc_Title, 1);
  285.     TextDrawBackgroundColor(fc_Title, 51);
  286.     TextDrawFont(fc_Title, 0);
  287.     TextDrawSetProportional(fc_Title, 1);
  288.    
  289.     for(new i = 0; i< 7; i++) TextDrawColor(fc_WeatherSlot[i], -1061109505);
  290.    
  291.     #if defined USE_CLOCK
  292.     fc_Clock = TextDrawCreate(552.333740, 4.853318, "23:59");
  293.     TextDrawLetterSize(fc_Clock, 0.539999, 2.234666);
  294.     TextDrawAlignment(fc_Clock, 1);
  295.     TextDrawColor(fc_Clock, -1061109505);
  296.     TextDrawSetShadow(fc_Clock, 0);
  297.     TextDrawSetOutline(fc_Clock, 1);
  298.     TextDrawBackgroundColor(fc_Clock, 255);
  299.     TextDrawFont(fc_Clock, 3);
  300.     TextDrawSetProportional(fc_Clock, 1);
  301.    
  302.     td_ServerDay = TextDrawCreate(487.333374, 5.973349, "Wednesday");
  303.     TextDrawLetterSize(td_ServerDay, 0.449999, 1.600000);
  304.     TextDrawAlignment(td_ServerDay, 2);
  305.     TextDrawColor(td_ServerDay, -1378294017);
  306.     TextDrawSetShadow(td_ServerDay, 0);
  307.     TextDrawSetOutline(td_ServerDay, 1);
  308.     TextDrawBackgroundColor(td_ServerDay, 51);
  309.     TextDrawFont(td_ServerDay, 3);
  310.     TextDrawSetProportional(td_ServerDay, 1);
  311.     #endif
  312.    
  313.     for(new i=0;i<MAX_GROUPS;++i) tdenum[i][count2] = -1;
  314.     tdGroup_Forecast = CreateTDGroup(fc_Border, fc_Title, fc_Background, fc_DaySlot[0], fc_DaySlot[3], fc_DaySlot[1], fc_DaySlot[2], fc_DaySlot[4], fc_DaySlot[5], fc_DaySlot[6], fc_WeatherSlot[0], fc_WeatherSlot[1], fc_WeatherSlot[2], fc_WeatherSlot[3], fc_WeatherSlot[4], fc_WeatherSlot[5], fc_WeatherSlot[6]);
  315.  
  316.     SetWorldTime(12);
  317.     timerWorldHours = 12;
  318.     timerWorldMinutes = 0;
  319.     weekNeedle = 0;
  320.    
  321.     for(new i = 0; i < sizeof weekWeather; i++) {
  322.         weekWeather[i] = possibleWeathers[random(sizeof(possibleWeathers))][0][0];
  323.         nextWeekWeather[i] = weekWeather[i];
  324.     }
  325.    
  326.     SetWeather(weekWeather[weekNeedle]);
  327.  
  328.     timerUpdateTime = SetTimer("UpdateServerTime", 1000, true);
  329.    
  330.     #if defined USE_CLOCK
  331.     TextDrawSetString(td_ServerDay, weekDays[weekNeedle]);
  332.     #endif
  333.     return 1;
  334. }
  335.  
  336. public UpdateServerTime()
  337. {
  338.     #if defined USE_CLOCK
  339.     new hourString[5];
  340.     new minuteString[5];
  341.     new timeString[5+5+1+1];
  342.     #endif
  343.    
  344.     timerWorldMinutes++;
  345.     if(timerWorldMinutes >= 60) {
  346.         timerWorldMinutes = 0;
  347.         timerWorldHours++;
  348.     }
  349.     if(timerWorldHours >= 24) {
  350.         timerWorldHours = 0;
  351.     }
  352.    
  353.     #if defined USE_CLOCK
  354.     if(timerWorldMinutes < 10) {
  355.         format(minuteString, sizeof minuteString, "0%d", timerWorldMinutes);
  356.     }
  357.     else format(minuteString, sizeof minuteString, "%d", timerWorldMinutes);
  358.  
  359.     if(timerWorldHours < 10) {
  360.         format(hourString, sizeof hourString, "0%d", timerWorldHours);
  361.     }
  362.     else format(hourString, sizeof hourString, "%d", timerWorldHours);
  363.  
  364.     format(timeString, sizeof timeString, "%s:%s", hourString, minuteString);
  365.     TextDrawSetString(fc_Clock, timeString);
  366.     #endif
  367.    
  368.     if(timerWorldHours == 23 && timerWorldMinutes == 59) {
  369.         weekNeedle++;
  370.         if(weekNeedle == sizeof(weekWeather)) {
  371.             //print("Week is over. Starting new week...");
  372.             //print("This week's weather:");
  373.             for(new i = 0; i < sizeof weekWeather; i++) {
  374.                 weekWeather[i] = nextWeekWeather[i];
  375.                 //printf("%s: %s(%d)", weekDays[i], possibleWeathers[weekWeather[i]][1], possibleWeathers[weekWeather[i]][0]);
  376.             }
  377.             weekNeedle = 0;
  378.             //printf("%s: Weather: %s(%d)", weekDays[weekNeedle], possibleWeathers[weekWeather[weekNeedle]][1], weekWeather[weekNeedle]);
  379.         }
  380.         SetWeather(weekWeather[weekNeedle]);
  381.         new msgDay[144];
  382.         format(msgDay, sizeof msgDay, " [aWeather] >> "COLOR_BODY"Today is: %s. Weather foreseen for today: %s", weekDays[weekNeedle], possibleWeathers[weekWeather[weekNeedle]][1]);
  383.         SendClientMessageToAll(COLOR_PREFIX, msgDay);
  384.         #if defined USE_CLOCK
  385.         TextDrawSetString(td_ServerDay, weekDays[weekNeedle]);
  386.         #endif
  387.         //printf("%s: Weather: %s(%d)", weekDays[weekNeedle], possibleWeathers[weekWeather[weekNeedle]][1], weekWeather[weekNeedle]);
  388.  
  389.         /*for(new i = 0; i < sizeof nextWeekWeather; i++) {
  390.             new day;
  391.             if((weekNeedle + i) > 6) day = ((weekNeedle + i) - 7);
  392.             else day = weekNeedle + i;
  393.  
  394.             new tmpStr[24]; format(tmpStr, sizeof tmpStr, "~b~~h~~h~%s", weekDays[day]);
  395.             TextDrawSetString(fc_DaySlot[ i], tmpStr);
  396.             TextDrawSetString(fc_WeatherSlot[i], possibleWeathers[nextWeekWeather[i]][1]);
  397.         }*/
  398.        
  399.         nextWeekWeather[6] = possibleWeathers[random(sizeof(possibleWeathers))][0][0];
  400.  
  401.         for(new i = 0; i < (sizeof(nextWeekWeather)-1); i++) {
  402.             nextWeekWeather[i] = nextWeekWeather[i+1];
  403.             //printf("Day %d: Weather: %s(%d)", i+1, possibleWeathers[nextWeekWeather[i]][1], nextWeekWeather[i]);
  404.         }
  405.  
  406.  
  407.  
  408.         //printf("Day %d: Weather: %s(%d)", sizeof nextWeekWeather, possibleWeathers[nextWeekWeather[sizeof(nextWeekWeather)-1]][1], nextWeekWeather[sizeof(nextWeekWeather)-1]);*/
  409.  
  410.         //nextWeekWeather[weekNeedle] = possibleWeathers[random(sizeof(possibleWeathers))][0][0];
  411.  
  412.  
  413.  
  414.         for(new i = 0; i < sizeof nextWeekWeather; i++) {
  415.             new day;
  416.             if((weekNeedle + i) > 6) day = ((weekNeedle + i) - 7);
  417.             else day = weekNeedle + i;
  418.            
  419.  
  420.             //printf("%d",day);
  421.             TextDrawSetString(fc_DaySlot[ i ], weekDays[day]);
  422.             TextDrawSetString(fc_WeatherSlot[i], possibleWeathers[nextWeekWeather[i]][1]);
  423.         }
  424.  
  425.     }
  426.  
  427.     foreach(new i: Player) {
  428.         SetPlayerTime(i, timerWorldHours, timerWorldMinutes);
  429.     }
  430.     //print(timeString);
  431.     return 1;
  432. }
  433.  
  434. public OnFilterScriptExit()
  435. {
  436.     #if defined USE_CLOCK
  437.     TextDrawDestroy(fc_Clock);
  438.     TextDrawDestroy(td_ServerDay);
  439.     #endif
  440.    
  441.     KillTimer(timerUpdateTime);
  442.     TextDrawDestroy(fc_Background);
  443.     TextDrawDestroy(fc_Border);
  444.     TextDrawDestroy(fc_Title);
  445.    
  446.     for(new i = 0; i < 7; i++) TextDrawDestroy(fc_DaySlot[i]), TextDrawDestroy(fc_WeatherSlot[i]);
  447.     return 1;
  448. }
  449.  
  450. CMD:forecast(playerid, params[])
  451. {
  452.     if(!playerWatchingForecast[playerid]) {
  453.         TDGroupShowForPlayer(playerid, tdGroup_Forecast);
  454.         for(new i = 0; i < sizeof nextWeekWeather; i++) {
  455.             new day;
  456.             if((weekNeedle + i) > 6) day = ((weekNeedle + i) - 7);
  457.             else day = weekNeedle + i;
  458.        
  459.  
  460.             new tmpStr[24]; format(tmpStr, sizeof tmpStr, "~b~~h~~h~%s", weekDays[day]);
  461.             TextDrawSetString(fc_DaySlot[ i], tmpStr);
  462.             TextDrawSetString(fc_WeatherSlot[i], possibleWeathers[nextWeekWeather[i]][1]);
  463.             playerWatchingForecast[playerid] = true;
  464.         }
  465.     }
  466.     else {
  467.         TDGroupHideForPlayer(playerid, tdGroup_Forecast);
  468.         playerWatchingForecast[playerid] = false;
  469.     }
  470.     return 1;
  471. }
  472.  
  473. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  474. {
  475.     if(PRESSED(KEY_NO)) {
  476.         TDGroupShowForPlayer(playerid, tdGroup_Forecast);
  477.         for(new i = 0; i < sizeof nextWeekWeather; i++) {
  478.             new day;
  479.             if((weekNeedle + i) > 6) day = ((weekNeedle + i) - 7);
  480.             else day = weekNeedle + i;
  481.             new tmpStr[24]; format(tmpStr, sizeof tmpStr, "~b~~h~~h~%s", weekDays[day]);
  482.             TextDrawSetString(fc_DaySlot[ i], tmpStr);
  483.             TextDrawSetString(fc_WeatherSlot[i], possibleWeathers[nextWeekWeather[i]][1]);
  484.             playerWatchingForecast[playerid] = true;
  485.         }
  486.     }
  487.     if(RELEASED(KEY_NO)) {
  488.         TDGroupHideForPlayer(playerid, tdGroup_Forecast);
  489.         playerWatchingForecast[playerid] = false;
  490.     }
  491.     return 1;
  492. }
  493.  
  494. public OnPlayerSpawn(playerid)
  495. {
  496.     #if defined USE_CLOCK
  497.     TextDrawShowForPlayer(playerid, fc_Clock);
  498.     TextDrawShowForPlayer(playerid, td_ServerDay);
  499.     #endif
  500.    
  501.     playerWatchingForecast[playerid] = false;
  502.     return 1;
  503. }
Advertisement
Add Comment
Please, Sign In to add comment