AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Removing vault data with nVault (https://forums.alliedmods.net/showthread.php?t=27383)

v3x 04-21-2006 07:24

Removing vault data with nVault
 
Is this how I would do it?
Code:
nvault_set(vault , key , "");

I'm trying to remove a SteamID from a vault file by command and doesn't want to work:
Code:
public concmd_removesteam(id , lvl , cid) {     if(!cmd_access(id , lvl , cid , 2))         return PLUGIN_HANDLED;     new arg[33];     read_argv(1 , arg , 32);     vault = nvault_open(VAULT_NAME);     if(vault == INVALID_HANDLE)     {         console_print(id , "[AMXX] Error opening vault file: %s" , VAULT_NAME);         return PLUGIN_HANDLED;     }     remove_quotes(arg);     trim(arg);     new temp[9] , timestamp;     if(!nvault_lookup(vault , arg , temp , 8 , timestamp))     {         console_print(id , "[AMXX] That STEAMID doesn't exist!");         nvault_close(vault);         return PLUGIN_HANDLED;     }     nvault_set(vault , arg , "");     nvault_close(vault);     new steamid[33] , players[32] , num , i;     for(i = 0; i < num; i++)     {         get_user_authid(players[i] , steamid , 32);         if(equal(steamid , arg))             flagged[players[i]] = false;     }     console_print(id , "[AMXX] %s removed from vault file: ^"%s^"" , arg , VAULT_NAME);     return PLUGIN_HANDLED; }

Twilight Suzuka 04-21-2006 07:59

I think thats about the only way.

v3x 04-21-2006 11:34

Is everything correct there?

v3x 04-22-2006 01:34

Oops, I forgot to use get_players. Anywho ... Is there anything wrong with that code?

slurpycof 04-22-2006 15:54

There 3 ways I can think to do what you are wanting to do.

1. If you can get nvault_delete function added

2. Log the person steam ID with const value of gaben and then check that value to set their global. When you want to remove them, set the value to something else. This will add more overhead though.

3. Read the timestamp for a certain entry and prune with that as your window. There is still a slight chance you could remove someone you didn't want to that was gabened at the exact same time. This may be the best option for actually removing the entry from the vault.

Code:
new temp[9] new delete_time, start_time, end_time nvault_lookup(vault , arg , temp , 8 , timestamp) delete_time = timestamp start_time = delete_time - 1 end_time = delete_time +1 nvault_prune (vault , start , end ) nvault_close(vault )

It's not all of the code, but the idea is there and nice and bunched up for you
:wink:

v3x 04-22-2006 16:02

I thought of doing #2 already. I guess I'll go with that. Thanks.


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

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