Raised This Month: $ Target: $400
 0% 

Expiration Date in default admin plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 06-19-2018 , 08:16   Re: Expiration Date in default admin plugin
Reply With Quote #1

Actually what 1.8.3 is mostly lacking to be released is features for end users, plugin writes did get a lot of new features. This would be welcome, actually all first party plugins should receive some love.
__________________
klippy is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-19-2018 , 08:27   Re: Expiration Date in default admin plugin
Reply With Quote #2

Quote:
Originally Posted by KliPPy View Post
Actually what 1.8.3 is mostly lacking to be released is features for end users, plugin writes did get a lot of new features. This would be welcome, actually all first party plugins should receive some love.
And using 1.8.3 natives Mr.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
ish12321
Veteran Member
Join Date: May 2016
Old 06-23-2018 , 15:14   Re: Expiration Date in default admin plugin
Reply With Quote #3

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 - 591 views - 20.0 KB)
__________________
['O|s|G'] | Death Wins a.k.a Ish Chhabra was here
ish12321 is offline
Kushfield
Member
Join Date: Jan 2017
Location: Estonia
Old 06-23-2018 , 16:06   Re: Expiration Date in default admin plugin
Reply With Quote #4

What exactly is the output?

You're making that stock way more complicated than it has to be by the way:
PHP Code:
stock getExpirationDate(duration) {
    new 
szExpirationDate[15];
    
format_time(szExpirationDatecharsmax(szExpirationDate), "%Y%m%d"get_systime() + (duration 86400));
    return 
str_to_num(szExpirationDate);

Not sure why you return a str_to_num if you do a num_to_str on it right after.

Also, to automatically add a leading zero to an integer if it's a 1-digit number, you can use the following format:
PHP Code:
formatex(szExpirationDatecharsmax(szExpirationDate), "%d%02d%02d"yearmonthday); 
Kushfield is offline
ish12321
Veteran Member
Join Date: May 2016
Old 06-23-2018 , 16:15   Re: Expiration Date in default admin plugin
Reply With Quote #5

Quote:
Originally Posted by Kushfield View Post
What exactly is the output?

You're making that stock way more complicated than it has to be by the way:
PHP Code:
stock getExpirationDate(duration) {
    new 
szExpirationDate[15];
    
format_time(szExpirationDatecharsmax(szExpirationDate), "%Y%m%d"get_systime() + (duration 86400));
    return 
str_to_num(szExpirationDate);

Not sure why you return a str_to_num if you do a num_to_str on it right after.

Also, to automatically add a leading zero to an integer if it's a 1-digit number, you can use the following format:
PHP Code:
formatex(szExpirationDatecharsmax(szExpirationDate), "%d%02d%02d"yearmonthday); 
Thank you
__________________
['O|s|G'] | Death Wins a.k.a Ish Chhabra was here
ish12321 is offline
yousuf khan
Member
Join Date: May 2019
Old 07-29-2020 , 09:08  
Reply With Quote #6

Can You Give Me Example Like This:

"killer" "123" "bceijmtu" "a" ; Expiration:

Tell Me What I Add In Expiration?

Last edited by asherkin; 07-29-2020 at 09:37.
yousuf khan is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:12.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode