Raised This Month: $ Target: $400
 0% 

nVault Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
quilhos
Veteran Member
Join Date: Jun 2010
Old 09-29-2012 , 10:45   nVault Problem
Reply With Quote #1

What is wrong with this nvault system? (My server dont give logs, but he dont start and I have sure that nvault have the problem).

PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < nvault  >
#include < nvault_util >

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "..."

new gVault
new g_iAuthID[33][32]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
        
gVault nvault_open "Pointmod" )
}

public 
plugin_end ( )
{
        
nvault_close gVault )
}
 
public 
client_authorized iPlayer )
{
        
get_user_authid iPlayerg_iAuthID iPlayer ], charsmaxg_iAuthID[] ) )
       
        
Load iPlayer )
}
 
public 
client_disconnect iPlayer )
{
        
Save iPlayer )
}

public 
Load iPlayer )
{
        static 
data 256 ], timestamp
        
new gAuthID[32];
        
get_user_authid(iPlayergAuthIDcharsmax(gAuthID));
        if ( 
nvault_lookup gVaultg_iAuthID iPlayer ], datasizeof data ) - 1timestamp ) )
                
ParseLoadData iPlayerdata )
        else
                
NewUser iPlayer )
}
 
public 
NewUser iPlayer )
{
        
cFirstTime iPlayer ] = 1
 
        iPoint 
iPlayer ] = pStart
       
        
for ( new iTer 0iTer TUpgradesiTer++ )
                
TLevel iPlayer ] [ iTer ] = 0
        
for ( new iCT 0iCT CTUpgradesiCT++ )
                
CTLevel iPlayer ] [ iCT ] = 0
}
 
ParseLoadData iPlayerdata 256 ] )
{
        static 
num ]
        
strbreak datanumsizeof num ) - 1datasizeof data ) - )
       
        
iPoint iPlayer ] = str_to_num num )
       
        for ( new 
iTer 0iTer TUpgradesiTer++ )
        {
                
strbreak datanumsizeof num ) - 1datasizeof data ) - )
                
TLevel iPlayer ] [ iTer ] = clamp str_to_num num ), 0TMaxLevel iTer ] )
        }
        for ( new 
iCT 0iCT CTUpgradesiCT++ )
        {
                
strbreak datanumsizeof num ) - 1datasizeof data ) - )
                
CTLevel iPlayer ] [ iCT ] = clamp str_to_num num ), 0CTMaxLevel iCT ] )
        }
}
 
public 
Save iPlayer )
{
        static 
data 256 ]
        new 
gAuthID[32];
        
get_user_authid(iPlayergAuthIDcharsmax(gAuthID));
        new 
len formatex datasizeof data ) - 1"%i"iPoint iPlayer ] )
       
        for ( new 
iTer 0iTer TUpgradesiTer++ )
                
len += formatex data len ], sizeof data ) - len 1" %i"TLevel iPlayer ] [ iTer ] )
        for ( new 
iCT 0iCT CTUpgradesiCT++ )
                
len += formatex data len ], sizeof data ) - len 1" %i"CTLevel iPlayer ] [ iCT ] )
       
        
nvault_set gVaultg_iAuthID iPlayer ], data )

__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!

Last edited by quilhos; 09-29-2012 at 10:45.
quilhos is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-29-2012 , 11:24   Re: nVault Problem
Reply With Quote #2

I have a few notes. And because i'm writing this while i'm reading through the code I may not actually solve the problem, but i'm looking.
1. in load function, you do not need to call get_user_authid again. You never use use gAuthID anyway.
2. g_iAuthID is a string, not an int. name it g_szAuthID -just a suggestion
3. I thaknk ParseLoadData should look like this: ParseLoadData(iPlayer, data, iMaxLen) i'm sure you can figure out why.
4. you seem to be missing a lot of variable declarations. cFirstTime, iPoint, pStart, Tlevel, etc
5. you should use charsmax() instead of sizeof(szString) - 1 -that's just easier to read, though functionally equivalent.

Other than that...i don't see the issue. I'd suggest logging everything that happens with the vault. The data saved, the data retrieved. etc etc. This will give you more of an idea of what's going on. use log_to_file native if you're not familiar with it.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
quilhos
Veteran Member
Join Date: Jun 2010
Old 09-29-2012 , 11:41   Re: nVault Problem
Reply With Quote #3

I can send to you the complete code for PM? It's a private plugin x:
__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!
quilhos is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-29-2012 , 12:16   Re: nVault Problem
Reply With Quote #4

i'm lazy ATM and about to go AFK.
if those are actually defined i'll take your word for it.
Do the logging i suggested and report anything you learn from that.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
quilhos
Veteran Member
Join Date: Jun 2010
Old 09-29-2012 , 12:25   Re: nVault Problem
Reply With Quote #5

The logging is useless, because my server crash, not if the pointmod is new, but when is "old". In the first time that I install the plugin, all works fine, but now the server crash...
__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!
quilhos is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-29-2012 , 12:45   Re: nVault Problem
Reply With Quote #6

OH! That happens to me a lot.
Its quite an unfortunate problem, but with a simple solution.
Delete your .vault file from your /data/nvault on your ftp
This should fix it.
I don't know why it happens.
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 09-29-2012 at 12:46.
Liverwiz is offline
quilhos
Veteran Member
Join Date: Jun 2010
Old 09-29-2012 , 12:50   Re: nVault Problem
Reply With Quote #7

But my players will lose the XP that they fight for..
__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!
quilhos is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-30-2012 , 08:49   Re: nVault Problem
Reply With Quote #8

Quote:
Originally Posted by quilhos View Post
But my players will lose the XP that they fight for..
Back it up. Then delete it. See if it is a fix. Then you might be able to enter the data manually.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
quilhos
Veteran Member
Join Date: Jun 2010
Old 09-30-2012 , 10:08   Re: nVault Problem
Reply With Quote #9

I fix this without delete anything.

Code:
1º- Download nVault Reader
2º- Search for a white spot (usual in the first entrie)
3º- Delete the white line
4º- Put in addons/amxmodx/data/vault your nvault file
__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!

Last edited by quilhos; 09-30-2012 at 10:09.
quilhos is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-30-2012 , 10:21   Re: nVault Problem
Reply With Quote #10

Quote:
Originally Posted by quilhos View Post
I fix this without delete anything.

Code:
1º- Download nVault Reader
2º- Search for a white spot (usual in the first entrie)
3º- Delete the white line
4º- Put in addons/amxmodx/data/vault your nvault file
OH! That's an awesome note! Thanks for sharing. It'll save me aggravation in the future.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:19.


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