Thread: nVault Tutorial
View Single Post
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-18-2012 , 19:42   Re: nVault
Reply With Quote #40

Quote:
Originally Posted by Exolent[jNr] View Post
Change
PHP Code:
nvault_prune_key(g_score_vaultszDeathKeyget_systime(), 86400 get_pcvar_num(amx_death_expire_days)) 
to
PHP Code:
nvault_prune_key(g_score_vaultszDeathKey0get_systime() + (86400 get_pcvar_num(amx_death_expire_days))) 
That will delete all entries. start=0 with end=get_systime() would delete all; in addition you are adding excess days onto now which says delete everything from the start of time until 15 days from now. Change + to - and it is good, as I posted in #37.

Quote:
Originally Posted by bibu View Post
Bugsy I am thinking abit wrong and couldn't really understand your explanation. Could you rephrase that?
When you prune, you are deleting entries that have a time stamp that falls within Start and End range. So for start time you use 0 (beginning of Epoch time) and for the end date you use now minus the number of days for expired entries. A timestamp is the number of seconds that have elapsed since 01/01/70 (IIRC), so the lower the number, the older the time is from now. Suppose you wanted to delete items that are older than 15 days:

0 < 17 day old entry to delete < 15 days from now
0 < 1328148921(now minus 17 days) < 1328321721(now minus 15 days)

Here's some math:

Start = 0

Calculate End time value (Now - 15 days)
  • Now = 1329610846
  • 15 Days = 1296000
  • 1329610846 - 1296000 = 1328314846

Outdated entry example to delete (17 days old, Now - 17 days)
  • 17 Days = 1468800
  • 1329610846 - 1468800 = 1328142046

Delete this 17 day old entry since:
0(Start) < 1328142046(17 day old entry) < 1328314846(now - 15 days)

So what you want is this:
PHP Code:
nvault_prune_keyg_score_vault szDeathKey get_systime() - ( 86400 get_pcvar_numamx_death_expire_days ) ) ) 
__________________

Last edited by Bugsy; 02-18-2012 at 21:21.
Bugsy is offline