Thread: nVault Tutorial
View Single Post
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-30-2022 , 22:34   Re: nVault Tutorial
Reply With Quote #117

PHP Code:
//plugin_cfg - Clear out everything that is in the vault up until current time
//This will eliminate all records that have expired
nvault_prunevault get_systime() );

//give playe something
nvault_setvault "STEAM:0:12345" "glock" );
//Set the timestamp to now + 1 day
nvault_touchvault "STEAM:0:12345" get_systime() + 86400 );

//player trying to do something
if ( nvault_lookupvault "STEAM:0:12345" szVal charsmaxszVal ) , iTS ) )
    
//item found
else
   
//item expired or never existed (doesnt exist in vault right now) 
You can instead not prune, and respond to the player accordingly based on the expired timestamp value returned by nvault_lookup().
PHP Code:
if ( iTS get_systime() )
   
//Sorry, this item has expired 
__________________

Last edited by Bugsy; 04-30-2022 at 22:53.
Bugsy is offline