Advertisement
ZumeZero

[Include] zTime SA:MP - 19-03-2015 UP

Aug 24th, 2014
2,724
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PCRE 1.33 KB | None | 0 0
  1. /* zTime - _Zume */
  2.  
  3. stock GetMonthName(month)
  4. {
  5.     static const MonhtsYears[12][24] = {
  6.         "Enero",
  7.         "Febrero",
  8.         "Marzo",
  9.         "Abril",
  10.         "Mayo",
  11.         "Junio",
  12.         "Julio",
  13.         "Agosto",
  14.         "Septiembre",
  15.         "Octubre",
  16.         "Noviembre",
  17.         "Diciembre"
  18.     };
  19.     new
  20.         month_str[24]
  21.         ;
  22.        
  23.     format(month_str, sizeof(month_str), "%s", MonhtsYears[month+1]);
  24.     return month_str;
  25. }
  26.  
  27. stock GetDayOfWeek(day, month, year)
  28. {
  29.     static const DaysWeek[7][24] = {
  30.         "Lunes",
  31.         "Martes",
  32.         "Miércoles",
  33.         "Jueves",
  34.         "Viernes",
  35.         "Sábado",
  36.         "Domingo"
  37.     };
  38.     new
  39.         d_[4],
  40.         m_[10]
  41.     ;
  42.  
  43.     d_[0] = (14-month) / 12, d_[2] = year - d_[0], d_[1] = month + (12*d_[0]) - 2;
  44.     d_[3] = (day + d_[2] + (d_[2]/4) - (d_[2]/100) + (d_[2]/400) + (31*d_[1]) / 12) % 7;
  45.     if(d_[3] == 0) d_[3] = 7;
  46.     format(m_, sizeof(m_), "%s", DaysWeek[d_[3]+1]);
  47.     return m_;
  48. }
  49.  
  50. stock GetTime()
  51. {
  52.     new
  53.         m_[34],
  54.         d_[3]
  55.     ;
  56.  
  57.     gettime(d_[0], d_[1], d_[2]), format(m_, sizeof(m_), "%02d:%02d:%02d", d_[0], d_[1], d_[2]);
  58.     return m_;
  59. }
  60.  
  61. stock GetDate()
  62. {
  63.     new
  64.         m_[34],
  65.         d_[3]
  66.     ;
  67.  
  68.     getdate(d_[0], d_[1], d_[2]);
  69.     format(m_, sizeof(m_), "%s %d de %s del %d", GetDayOfWeek(d_[0], d_[1], d_[2]), d_[2], GetMonthName(d_[1]), d_[0]);
  70.     return m_;
  71. }
  72.  
  73. stock IsLeapDay(year)
  74. {
  75.     return ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement