SA-MP Forums Archive
How to get the day of the week. Ex: Monday, Tuesday... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to get the day of the week. Ex: Monday, Tuesday... (/showthread.php?tid=546357)



How to get the day of the week. Ex: Monday, Tuesday... - k0r - 15.11.2014

Title says everything.
I want to use this function in Textdraw to show player what day is it.


Re: How to get the day of the week. Ex: Monday, Tuesday... - OG Killo - 15.11.2014

Wot? Confused.


Re: How to get the day of the week. Ex: Monday, Tuesday... - Sparke - 15.11.2014

Day of week to what... Be more descriptive


Re: How to get the day of the week. Ex: Monday, Tuesday... - k0r - 15.11.2014

Quote:
Originally Posted by OG Killo
Посмотреть сообщение
Wot? Confused.
Quote:
Originally Posted by Sparke
Посмотреть сообщение
Day of week to what... Be more descriptive
A function that returns day of the week. Like Monday, Tuesday.
It checks and finds the correct name of the day.
I want to use this function in textdraw to show player what day is it.


Re: How to get the day of the week. Ex: Monday, Tuesday... - AzaMx - 15.11.2014

There are many filterscripts for it, you can find it.


Re: How to get the day of the week. Ex: Monday, Tuesday... - k0r - 15.11.2014

Quote:
Originally Posted by AzaMx
Посмотреть сообщение
There are many filterscripts for it, you can find it.
Thanks. Forgot & too lazy to search for it.


Re: How to get the day of the week. Ex: Monday, Tuesday... - dominik523 - 15.11.2014

Код:
// credits to yom
stock GetWeekDay(day=0, month=0, year=0)
{
  if (!day)
    getdate(year, month, day);

  new
    weekday_str[10],
    j,
    e
  ;

  if (month <= 2)
  {
    month += 12;
    --year;
  }

  j = year % 100;
  e = year / 100;

  switch ((day + (month+1)*26/10 + j + j/4 + e/4 - 2*e) % 7)
  {
    case 0: weekday_str = "Saturday";
    case 1: weekday_str = "Sunday";
    case 2: weekday_str = "Monday";
    case 3: weekday_str = "Tuesday";
    case 4: weekday_str = "Wednesday";
    case 5: weekday_str = "Thursday";
    case 6: weekday_str = "Friday";
  }

  return weekday_str;
}