AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   NVault reands data once on the map? ;o (https://forums.alliedmods.net/showthread.php?t=188740)

Screeaam.. 06-29-2012 21:15

NVault reands data once on the map? ;o
 
Hello! I'm using nvault_util http://forums.alliedmods.net/showthread.php?t=139584 and I have problem.

The file saves some ID nvault where the key is Nick writes such a random ID.

Code:

public Save(id)
{
        new vaultkey[128],vaultdata[256], nick[35];
        get_user_name(id, nick, 34);
       
        format(vaultdata, charsmax(vaultdata),"#%i", GID[id]); // GID[id] = Random ID;
       
        format(vaultkey, charsmax(vaultkey),"%s-GID", name);
        nvault_set(vaultGID,vaultkey,vaultdata);
       
        return PLUGIN_CONTINUE;
}

And I'm using NVault_Util to retrieve datas where GID[data] == GID[id]:

Code:

public GetData(id)
{
        new iPos , szKey[ 32 ] , szVal[ 64 ] , iTimeStamp, GID2;
        new iVaultHandle = nvault_util_open("GID2")
        new iCount = nvault_util_count(iVaultHandle);
        new name[35];
       
        for ( new iCurrent = 1 ; iCurrent <= iCount ; iCurrent++ )
        {
                iPos = nvault_util_read( iVaultHandle , iPos , szKey , charsmax( szKey ) , szVal , charsmax( szVal ) , iTimeStamp );
               
                replace_all(szVal, 63, "#", " ");
               
                new date[32];
                parse(szVal, date, 31);
               
                GID2 = str_to_num(dane);
               
                if(GID[id] == GID2)
                {
                        format(name, 34, "%s",szKey);
                        name[strlen(name)-4] = 0;
                        client_print(id, print_chat, "%s", name);
                }
        }
        nvault_util_close(iVaultHandle);
}

But when someone writes a GID in NVault during the game, he no longer appears in GetData(id), until a map change can I fix it somehow?

It seems that once NVault reads data at startup and then does not. I tried to load the data again in the game, but it did not help.

Bugsy 06-29-2012 21:22

Re: NVault reands data once on the map? ;o
 
No way to "fix" this, data is saved in the journal only until nvault_close or map-change/server shut-down.

Screeaam.. 06-29-2012 22:04

Re: NVault reands data once on the map? ;o
 
Ok.. Is there another way to read and write that data excluding MySQL?

YamiKaitou 06-29-2012 22:09

Re: NVault reands data once on the map? ;o
 
SQLite is another way. It is similar to MySQL but the database is store locally instead of remote

Screeaam.. 06-29-2012 22:14

Re: NVault reands data once on the map? ;o
 
What about FVault?

SQLite for me it's black magic. If given a choice between MySQL and SQLite is a MySQL would have taken, because more I understand him. But not so good to using it.


All times are GMT -4. The time now is 15:16.

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