View Single Post
ish12321
Veteran Member
Join Date: May 2016
Old 06-23-2018 , 15:14   Re: Expiration Date in default admin plugin
Reply With Quote #7

Hello,
I updated the code as above had few bugs. The plugin works fine if I add properly in users.ini. However, when I use amx_addadmin the expirationdate is not correctly added to users.ini. I doubt error is in
Code:
stock getExpirationDate(duration) {
	new year, month, day;
	date(year, month, day);

	day += duration;

	switch(month) {
			case 1, 3, 5, 7, 8, 10, 12 : {
				if(day > 31) {
					day -= 31;
					month += 1;
				}
			}
			case 2, 4, 6, 9, 11 : {
				if(day > 30) {
					day -= 30;
					month += 1;
				}
			}
	}

	new szExpirationDate[15];
	formatex(szExpirationDate, charsmax(szExpirationDate), "%d%s%s", year, month >= 10 ? "%d" : "0%d", month, day >= 10 ? "%d" : "0%d", day);

	return str_to_num(szExpirationDate);
}
If it is here, could someone point the error ? If not, could someone please check the code and point error ?
Attached Files
File Type: sma Get Plugin or Get Source (admin.sma - 581 views - 20.0 KB)
__________________
['O|s|G'] | Death Wins a.k.a Ish Chhabra was here
ish12321 is offline