Raised This Month: $ Target: $400
 0% 

[SOLVED][nVault] Loading problems


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-23-2011 , 08:55   Re: [nVault] Loading problems
Reply With Quote #4

Quote:
Originally Posted by Excalibur.007 View Post
PHP Code:
SaveData(id)
{
    new 
vaultkey[64],vaultdata[256]
    
    
formatex(vaultkey63"%s"iUserSavedPassword[id])
    
formatex(vaultdata255"%i %i"iRank[id], iXP[id])
    
    
nvault_set(nVaultvaultkeyvaultdata)
    
    return 
PLUGIN_CONTINUE
}

LoadData(id)
{
    new 
vaultkey[64],vaultdata[256]
    
    
formatex(vaultkey63"%s"iUserSavedPassword[id])
    
formatex(vaultdata255"%i %i"iRank[id], iXP[id])
    
    
nvault_get(nVaultvaultkeyvaultdata255)
    
    new 
Rank[32], XP[32]
    
parse(vaultdataRank31XP31)
    
    
iRank[id] = str_to_num(Rank)
    
iXP[id] = str_to_num(XP)
    
    return 
PLUGIN_CONTINUE

Saving is not a problem. But loading it is a problem.

What is the problem?
- Loading works but it loads the wrong thing.
- E.g. You are Colonel rank but when it loads, it changes to Private rank.
- Same goes for EXP. They get resetted to 0.

Description
- Private is the default rank when they login.

nVault Editor view

Key: test
Value: 14 204800

Where key is the password for login, 14 is the rank number and 204800 is the EXP.

Extra information
PHP Code:
new const RANKS[][]=
{
    
"Unranked"// 0
    
"Private"// 1
    
"Private 1st Class"// 2
    
"Corporal"// 3
    
"Sergeant"// 4
    
"Staff Sergeant"// 5
    
"Sergeant 1st Class"// 6
    
"Master Sergeant"// 7
    
"Sergeant Major"// 8
    
"2nd Lieutenant"// 9
    
"1st Lieutenant"// 10
    
"Captain"// 11
    
"Major"// 12
    
"Lieutenant Colonel"// 13
    
"Colonel"// 14
    
"Brigadier General"// 15
    
"Major General"// 16
    
"Lieutenant General"// 17
    
"General"// 18
    
"General of the Army" // 19
}

new const 
EXP[] =
{
    
0// 0
    
0// 1
    
50// 2
    
100// 3
    
200// 4
    
400// 5
    
800// 6
    
1600// 7
    
3200// 8
    
6400// 9
    
12800// 10
    
25600// 11
    
51200// 12
    
102400// 13
    
204800// 14
    
409600// 15
    
819200// 16
    
1638400// 17
    
3276800// 18
    
6553600 // 19

Try logging the value of iUserSavedPassword inside of the load function.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
 



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 23:24.


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