getdate(...day) bug - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: getdate(...day) bug (
/showthread.php?tid=75310)
getdate(...day) bug -
Danut - 30.04.2009
I think this is a bug. I've tryed a command using the &day
pawn Код:
if(strcmp(cmd, "/date", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new mtext[20],dtext[20];
new year, month,day;
getdate(year, month, day);
if(month == 1) { mtext = "January"; }
else if(month == 2) { mtext = "February"; }
else if(month == 3) { mtext = "March"; }
else if(month == 4) { mtext = "April"; }
else if(month == 5) { mtext = "May"; }
else if(month == 6) { mtext = "June"; }
else if(month == 7) { mtext = "July"; }
else if(month == 8) { mtext = "August"; }
else if(month == 9) { mtext = "September"; }
else if(month == 10) { mtext = "October"; }
else if(month == 11) { mtext = "November"; }
else if(month == 12) { mtext = "December"; }
if(day == 1) { dtext = "Monday"; }
else if(day == 2) { dtext = "Tuesday"; }
else if(day == 3) { dtext = "Wednesday"; }
else if(day == 4) { dtext = "Thursday"; }
else if(day == 5) { dtext = "Friday"; }
else if(day == 6) { dtext = "Saturday"; }
else if(day == 7) { dtext = "Sunday"; }
format(string, sizeof(string), "%s~n~%s",mtext,dtext);
GameTextForPlayer(playerid, string, 5000, 1);
}
return 1;
}
He don't show me the day , why ?
Re: getdate(...day) bug - Double-O-Seven - 30.04.2009
Because day doesn't return day of week. I returns day of month.
Re: getdate(...day) bug -
Danut - 30.04.2009
so there's no posibility to show me the Day?
Re: getdate(...day) bug -
lavamike - 30.04.2009
Quote:
Originally Posted by MoroJr™
so there's no posibility to show me the Day?
|
I would probably create a file to read from like an ini file with dini and something like this:
DaysOfTheWeek.ini
1=Sunday
2=Monday
3=Tuesday
4=Wednesday
5=Thursday
6=Friday
7=Saturday
CurrentYear=2009
CurrentMonth=4
CurrentDay=30
CurrentDayOfWeek=5
---------------------------------------
Than all you have to do is compare dates in OnGameModeInit/OnFilterScriptInit
It would just take a little bit of thinking, not too hard to do. I think i'll make a script of this right now and release it :P
You could make it yourself or wait a bit and i'll release it
EDIT: There are a bunch of factors I didn't think about, and really don't want to bother with so. But that concept could kind of work. Either that or map out the days of the week according to the actual month day with a calender.
Unless someone else has an idea, it would probably take a long time and would be easier to get the day from a server if you have linux your could probably do that with Boyletts socket thing in plugins or hopefully they can add a function to read the day off the windows clock.
Re: getdate(...day) bug -
Weirdosport - 30.04.2009
There is a getweekday script currently in the Filterscripts and includes section.