diff options
author | shennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-02-09 14:10:58 +0000 |
---|---|---|
committer | shennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-02-09 14:10:58 +0000 |
commit | 4f05322208a4491a3b3d7adab59a0fab4f8d87f5 (patch) | |
tree | 81ac8b44e2b07bbc227ed7dc9902032ed35ff5f4 /src | |
parent | c10ec355a8eeb77ce30685bba38b57ba2852f79d (diff) | |
download | hercules-4f05322208a4491a3b3d7adab59a0fab4f8d87f5.tar.gz hercules-4f05322208a4491a3b3d7adab59a0fab4f8d87f5.tar.bz2 hercules-4f05322208a4491a3b3d7adab59a0fab4f8d87f5.tar.xz hercules-4f05322208a4491a3b3d7adab59a0fab4f8d87f5.zip |
Follow up r15557, modified it so that @ban only checks for @unban if the overall time is negative (before 1d-1h for example would fail). Credit goes to Gepard!
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15558 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 4f549fb66..701ef0ee8 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -3504,6 +3504,8 @@ ACMD_FUNC(char_ban) { char * modif_p; int year, month, day, hour, minute, second, value; + time_t timestamp; + struct tm *tmtime; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); @@ -3523,13 +3525,8 @@ ACMD_FUNC(char_ban) if (value == 0) modif_p++; else { - if (modif_p[0] == '-' || modif_p[0] == '+') { - if( modif_p[0] == '-' && get_atcommand_level("unban") > pc_isGM(sd) ) { - clif_displaymessage(fd,"You are not allowed to reduce the length of a ban"); - return -1; - } + if (modif_p[0] == '-' || modif_p[0] == '+') modif_p++; - } while (modif_p[0] >= '0' && modif_p[0] <= '9') modif_p++; if (modif_p[0] == 's') { @@ -3562,6 +3559,22 @@ ACMD_FUNC(char_ban) clif_displaymessage(fd, msg_txt(85)); // Invalid time for ban command. return -1; } + /** + * We now check if you can adjust the ban to negative (and if this is the case) + **/ + timestamp = time(NULL); + tmtime = localtime(×tamp); + tmtime->tm_year = tmtime->tm_year + year; + tmtime->tm_mon = tmtime->tm_mon + month; + tmtime->tm_mday = tmtime->tm_mday + day; + tmtime->tm_hour = tmtime->tm_hour + hour; + tmtime->tm_min = tmtime->tm_min + minute; + tmtime->tm_sec = tmtime->tm_sec + second; + timestamp = mktime(tmtime); + if( timestamp <= time(NULL) && get_atcommand_level("unban") > pc_isGM(sd) ) { + clif_displaymessage(fd,"You are not allowed to reduce the length of a ban"); + return -1; + } chrif_char_ask_name(sd->status.account_id, atcmd_player_name, 2, year, month, day, hour, minute, second); // type: 2 - ban clif_displaymessage(fd, msg_txt(88)); // Character name sent to char-server to ask it. |