Raised This Month: $32 Target: $400
 8% 

nVault; Data_Rank showing 0/x


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DJBosma
Member
Join Date: Dec 2009
Old 02-25-2019 , 04:46   nVault; Data_Rank showing 0/x
Reply With Quote #1

Dear users,

What I'm facing is the Data_Rank in "CmdStats" and "CmdShowRank" showing as 0/x on everyone.
I've tried different methods in order to understand where the issue comes from, all were unsuccessfull.
In CmdTopExpGlobal it does show the ranks right, but there it sorts using
Code:
Sort[count][1] = gData[index][Data_Exp]
SMA is attached.

Thanks in advance.
Attached Files
File Type: sma Get Plugin or Get Source (zp_uservault_clean.sma - 289 views - 30.2 KB)
DJBosma is offline
PartialCloning
Senior Member
Join Date: Dec 2015
Old 02-25-2019 , 05:59   Re: nVault; Data_Rank showing 0/x
Reply With Quote #2

You're saving data using player names? The save key and lookup keys are different. You format the keys during save and load, but you don't use them.

PHP Code:
public Save_Data(idszName[])
{
    new 
szKey[50], szData[MAX_FMT_LENGTH]
    
replace_all(gData[id][Data_Name], 31"#"" ")
    
formatex(szKey49"%s#EXP"gData[id][Data_Name])
    
formatex(szDatacharsmax(szData), "%d %d %d %d %d %d %d %d %d %d %s"gData[id][Data_Exp], gData[id][Data_Kills], gData[id][Data_Deaths], gData[id][Data_HeadShot], gData[id][Data_Knife], gData[id][Data_Nade], gData[id][Data_NemKills], gData[id][Data_SurKills], gData[id][Data_PlayTime], gData[id][Data_Level], gData[id][Data_Name])
    
nvault_set(iVaultHandleszNameszData)

As you can see, data is set using szName, not szKey.

PHP Code:
public Load_Data(szName[], id)
{
    if(!
is_user_connected(id))
        return

    new 
szName[32], szKey[50], szData[164]
    
copy(szName31gData[id][Data_Name])
    
replace_all(szName31"#"" ")
    
formatex(szKey49"%s#EXP"szName)
    
//formatex(szKey, 49, "%s#EXP", gData[id][Data_Name])
    //formatex(szKey, 49, "%s#EXP", gData[id][Data_Ip])    

    
if (nvault_get(iVaultHandleszNameszDatacharsmax(szData)))
... 
Data is also loaded using szName, not szKey. You're formatting szKey, but not using it.

"CmdStats" and "CmdShowRank" get ranks through "SortPlayerRank(id)".

PHP Code:
SortPlayerRank(id)
{
    new 
szName[32], szKey[50]
    
copy(szName31gData[id][Data_Name])
    
replace_all(szName31"#"" ")
    
formatex(szKey49"%s#EXP"szName)
.....


    for(new 
0sizeEntriesi++)
    {
        
ArrayGetArray(entriesidata)
        if(
equal(data[VD_Key],szKey))
        {
            
gData[id][Data_Rank] = i+1
            
break;
        }
    } 
You're looking for a szKey that doesn't exist.

You have to fix your save and load functions, or change SortPlayerRank to get the rank based on the player name, not the formatted szKey.
PartialCloning is offline
DJBosma
Member
Join Date: Dec 2009
Old 02-25-2019 , 07:42   Re: nVault; Data_Rank showing 0/x
Reply With Quote #3

Solved it,

Thank you.

Only thing I'm now facing is that on CmdShowRank Stage is "Stage: 71" or actually numeric.

Regards

Last edited by DJBosma; 02-25-2019 at 08:12.
DJBosma is offline
PartialCloning
Senior Member
Join Date: Dec 2015
Old 02-25-2019 , 12:35   Re: nVault; Data_Rank showing 0/x
Reply With Quote #4

PHP Code:
UTIL_ColorChat(id"^x04%s^x01 rank is^x04 %d^x01/^x04%d^x01 -- Kills:^x04 %d^x01 Deaths:^x04 %d^x01 Stage:^x04 %d^x01 Points:^x04 %d^x01/^x04%d"gData[id][Data_Name], iRankiTotalEntriesgData[id][Data_Kills], gData[id][Data_Deaths], szRanks[gData[id][Data_Level]], gData[id][Data_Exp], iEXP[gData[id][Data_Level]+1]) 
"Stage:^x04 %d" should be "Stage:^x04 %s".
PartialCloning is offline
DJBosma
Member
Join Date: Dec 2009
Old 02-25-2019 , 13:15   Re: nVault; Data_Rank showing 0/x
Reply With Quote #5

Well that's all folks.

Thanks in advance.

With kind regards,
D Bosma
DJBosma is offline
DJBosma
Member
Join Date: Dec 2009
Old 02-26-2019 , 10:55   Re: nVault; Data_Rank showing 0/x
Reply With Quote #6

P.S amxmod logs throw's this

Code:
L 02/26/2019 - 01:50:09: [AMXX] Displaying debug trace (plugin "zp_uservault_clean.amxx", version "1.1")
L 02/26/2019 - 01:50:09: [AMXX] Run time error 5: memory access 
L 02/26/2019 - 01:50:09: [AMXX]    [0] zp_uservault_clean.sma::Load_Data (line 895)
Attached Files
File Type: sma Get Plugin or Get Source (zp_uservault_clean.sma - 181 views - 30.5 KB)
DJBosma is offline
Reply


Thread Tools
Display Modes

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 00:41.


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