AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Loop through nvault data. (https://forums.alliedmods.net/showthread.php?t=100066)

Exceed 08-12-2009 06:13

Loop through nvault data.
 
Is it possible to loop through all the data in an nvault? I need to update some information on every user in the nvault(also for the ones not currently on the server) on map end.

Bugsy 08-12-2009 09:01

Re: Loop through nvault data.
 
Not possible. What you can do is use indexed keys which will allow you to access data while the player
is online and also iterate through all entries if needed. The downside is this will result in 2 nvault transactions
to lookup data on a per-player basis.

Checking for player data while player online:
1. Search vault using steam-id (or whatever unique identifier) to retrieve numeric key.
2. Use numeric key to retrieve player data

Iterate through all entries [for online\offline players]:
1. Create a key such as "NUMENTRIES" which will always hold the number
of player entries stored in the vault. You then can iterate 1 - [NUMENTRIES].
If you do not want to use a NUMENTRIES key you can keep attempting nvault_lookups
until no entry is found for the # key.

ie.
key=STEAM_0_0:12345 val=5
key=5 val=the data for this player

key=STEAM_0_0:54321 val=64
key=64 val=the data for this player

key=STEAM_0_0:11111 val=231
key=231 val=the data for this player

key=NUMENTRIES val=231
iterate nvault_lookup\nvault_get for keys "1" through "231"

Exolent[jNr] 08-12-2009 16:40

Re: Loop through nvault data.
 
FVault has this ability.

http://forums.alliedmods.net/showthread.php?t=76453

1101010 08-12-2009 17:01

Re: Loop through nvault data.
 
Go pro
Go MySQL

Exceed 08-13-2009 08:44

Re: Loop through nvault data.
 
I like the way you open/close and use nvault better, but it seems like fvault can do the job quite easy.


All times are GMT -4. The time now is 18:23.

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