Guest User

Day Include (c) by Kaliber

a guest
Nov 27th, 2012
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. /* Sa-Mp Include Days
  2.  *
  3.  * (c) by Kaliber, 2012
  4.  *
  5.  */
  6. #include <a_samp>
  7.  
  8. static ERROR_MSG[16] = "ERROR";
  9.  
  10. enum d_day {
  11.     day_s[16]
  12. };
  13. new DayInfo[8][d_day] = {
  14.     {"\0"},{"Montag"},{"Dienstag"},{"Mittwoch"},{"Donnerstag"},{"Freitag"},{"Samstag"},{"Sonntag"}
  15. };
  16.  
  17. stock GetDay()
  18. {
  19.     new y, m, d, var, i=1;
  20.     getdate(y,m,d);
  21.     var = Get_Var(y,m);
  22.     for(; i!=31; i++) {
  23.         if(i != d) var++;
  24.         if(var == 8) var = 1;
  25.         if(i == d) return DayInfo[var];
  26.     }
  27.     return ERROR_MSG;
  28. }
  29.  
  30. stock Get_Var(y,m)
  31. {
  32.     new x;
  33.     if(y == 2012) {
  34.         switch(m) {
  35.         case 1: x=7; case 2: x=3; case 3: x=4; case 4: x=7; case 5: x=2; case 6: x=5; case 7: x=6;
  36.         case 8: x=3; case 9: x=6; case 10: x=1; case 11: x=4; case 12: x=6;
  37.         }
  38.     }
  39.     else if(y == 2013){
  40.         switch(m) {
  41.         case 1: x=2; case 2: x=5; case 3: x=5; case 4: x=1; case 5: x=3; case 6: x=6; case 7: x=1;
  42.         case 8: x=4; case 9: x=7; case 10: x=2; case 11: x=4; case 12: x=7;
  43.         }
  44.     }
  45.     return x;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment