AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Code Snippets/Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=83)
-   -   New File Vault - A newer file vault system! (https://forums.alliedmods.net/showthread.php?t=92904)

Emp` 05-22-2009 15:21

Re: New File Vault - A newer file vault system!
 
Quote:

Originally Posted by Exolent[jNr] (Post 832545)
What is the advantage of using a "name" along with the "key" rather than formatting all of the data into one to save it, and then breaking it apart to use it.
Also, what about just formatting the "name" and "key" into one key?

It reduces read/write times when there is a lot of data saved.

Also, some config files plugins use have a format similar to this where it is broken down into subcategories.

AntiBots 05-24-2009 18:12

Re: New File Vault - A newer file vault system!
 
Thanks. Good Job :D

alan_el_more 09-24-2009 08:06

Re: New File Vault - A newer file vault system!
 
If the server crash, you lose all data -.-

Alucard^ 09-24-2009 12:46

Re: New File Vault - A newer file vault system!
 
GJ Emp... in this moment i don't need to use this but sure i will use it in another time. I like your tutorials.

Exolent[jNr] 09-24-2009 13:09

Re: New File Vault - A newer file vault system!
 
Quote:

Originally Posted by Emp` (Post 832097)
Pruning Data
  • Vault: Not Capable
  • NVault:
    Code:

    nvault_prune(vault, start, end);
  • FVault: Not Capable
  • NFVault:
    PHP Code:

    nfv_prune(const key[], const start=-1, const end=-1); 


Touching Little Boys Data
  • Vault: Not Capable
  • NVault:
    Code:

    nvault_touch(vault, const key[], timestamp=-1);
  • FVault: Not Capable
  • NFVault:
    PHP Code:

    nfv_touch(const filename[], const new_time=-1); 


FVault actually has these capabilities now.

The differences now is the way that the keys work.
Yours, you can have a name and a key, such as this:
Code:
new szFilename[ 128 ]; copy( szFilename, 127, nfv_file( "some_mod.txt" ) ); new szAuthid[ 35 ]; get_user_authid( client, szAuthid, 34 ); new szData[ 16 ]; // save num_to_str( get_user_frags( client ), szData, 15 ); nfv_set_data( szFilename, szAuthid, "frags", szData ); num_to_str( get_user_deaths( client ), szData, 15 ); nfv_set_data( szFilename, szAuthid, "deaths", szData ); // load nfv_get_data( szFilename, szAuthid, "frags", szData, 15 ); new iFrags = str_to_num( szData ); nfv_get_data( szFilename, szAuthid, "deaths", szData, 15 ); new iDeaths = str_to_num( szData );
Whereas mine would be:
Code:
new const szVaultName[ ] = "some_mod"; new szAuthid[ 35 ]; get_user_authid( client, szAuthid, 34 ); new szData[ 32 ]; // save formatex( szData, 31, "%i %i", get_user_frags( client ), get_user_deaths( client ) ); fvault_set_data( szVaultName, szAuthid, szData ); // load new szFrags[ 16 ], szDeaths[ 16 ]; fvault_get_data( szVaultName, szAuthid, szData, 31 ); parse( szData, szFrags, 15, szDeaths, 15 ); new iFrags = str_to_num( szFrags ); new iDeaths = str_to_num( szDeaths );

hleV 09-25-2009 10:28

Re: New File Vault - A newer file vault system!
 
I wish someone made a simple SQLite Vault.

Alka 09-25-2009 14:59

Re: New File Vault - A newer file vault system!
 
It's already made? AMXMODX base pack have sqlite, just make a tuple with null server/name/password then use the same syntaxes as MySQL.

hleV 09-25-2009 16:38

Re: New File Vault - A newer file vault system!
 
It would be easier to just do sqlite_[save|load]. I suck at SQL. It never works for me.

Bugsy 09-27-2009 00:43

Re: New File Vault - A newer file vault system!
 
Quote:

Originally Posted by hleV (Post 943307)
It would be easier to just do sqlite_[save|load]. I suck at SQL. It never works for me.

I agree and second this idea\request. A module that does SQL transactions with the ease of nvault-esque commands. I may start trying to put something together for this.

Emp` 12-05-2009 13:20

Re: New File Vault - A newer file vault system!
 
1 Attachment(s)
Changes on new update:
  • Added several "advanced" functions
  • Added tagged functions for easier saving
  • Added several tagged player functions
  • Added extra string functions
  • Changed param overwrite to a bitsum of properties
  • "get" functions now have extra params for seeking and finding
  • Wildcard constant for key and name lets it detect anything
  • "get" functions have extra params for copying when Wildcard is used
  • Data will by default clean itself of "s by putting a temporary replacement character. (Retrieving data will put "s back in)


Attaching old version below for backup reasons. See first post for new version.


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

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