diff options
Diffstat (limited to 'npc')
-rw-r--r-- | npc/003-3/malindou.txt | 1 | ||||
-rw-r--r-- | npc/functions/util.txt | 15 |
2 files changed, 13 insertions, 3 deletions
diff --git a/npc/003-3/malindou.txt b/npc/003-3/malindou.txt index a60fea146..ad4a9d564 100644 --- a/npc/003-3/malindou.txt +++ b/npc/003-3/malindou.txt @@ -667,6 +667,7 @@ OnInit: OnClock0500: if (gettime(GETTIME_DAYOFMONTH) >= 7) query_sql("DELETE FROM `chatlog` WHERE `time` < '"+sqldate(-7)+"'"); + query_sql("DELETE FROM `picklog` WHERE `time` < '"+sqldate(0, -3)+"'"); end; // This is for HUB diff --git a/npc/functions/util.txt b/npc/functions/util.txt index 80071b375..0c6453634 100644 --- a/npc/functions/util.txt +++ b/npc/functions/util.txt @@ -1157,15 +1157,24 @@ function script numdate { } // Same as numdate() but SQL format. -// sqldate({day variation}) +// sqldate({day variation, month variation}) function script sqldate { .@d=gettime(GETTIME_DAYOFMONTH)+getarg(0, 0); - .@m=gettime(GETTIME_MONTH); + .@m=gettime(GETTIME_MONTH)+getarg(1, 0); + .@y=gettime(GETTIME_YEAR); // Overflow prevention if (.@d <= 0) { .@d=1; } - .@strdate$=sprintf("%04d-%02d-%02d %02d:%02d:%02d", gettime(GETTIME_YEAR), .@m, .@d, gettime(GETTIME_HOUR), gettime(GETTIME_MINUTE), gettime(GETTIME_SECOND)); + while (.@m > 12) { + .@y+=1; + .@m-=12; + } + while (.@m < 1) { + .@y-=1; + .@m+=12; + } + .@strdate$=sprintf("%04d-%02d-%02d %02d:%02d:%02d", .@y, .@m, .@d, gettime(GETTIME_HOUR), gettime(GETTIME_MINUTE), gettime(GETTIME_SECOND)); return .@strdate$; } |