AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   function should expire on specific date (https://forums.alliedmods.net/showthread.php?t=24841)

Guenhwyvar 03-03-2006 13:46

function should expire on specific date
 
I have a function which should work only until a specific date and expire after.

I have the idea that a if code have to be placed into the first lines of that function:

Code:
expireDate = "2006/04/01" if (currentDate < expireDate) return PLUGIN_HANDLED

But I need help on the date checking.

Thanx in advance!

Des12 03-03-2006 15:54

http://www.amxmodx.org/funcwiki.php?go=func&id=249

Guenhwyvar 03-04-2006 04:32

Thanks des, but could you give me an example checking if the current date is later/equal the date given by the var expireDate?

Kraugh 03-04-2006 14:19

if i'm right in assuming how these date commands work:

Code:
new expireDate[32], currentDate[32]; expireDate = "2006/04/01"; get_time("%Y/%m/%d",currentDate,31); if(parse_time(currentDate,"%Y/%m/%d") > parse_time(expireDate,"%Y/%m/%d")) {    // expired }

i'm not totally sure though, the time functions appear confusing and misleading to me.

Xanimos 03-04-2006 16:21

use get_systime from you set it and add however many seconds to make it your expire date then just check it with get_systime again.

Guenhwyvar 03-05-2006 05:35

Thanks for the help, I think get_systime is working for me. A little bit more calculation beforehand, but I do not have to handle with dates in the function.


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

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