Raised This Month: $ Target: $400
 0% 

nVault


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-29-2014 , 03:50   Re: nVault
Reply With Quote #1

Why do you you need to loop through it? What does this array contain?
__________________
fysiks is offline
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 11-29-2014 , 11:25   Re: nVault
Reply With Quote #2

It contains g_szSomething

PHP Code:
new const g_szSomething[][] =
{
      
"First",
      
"Second",
      
"Third"
      
// etc.
};

new 
boolg_bTrue[33][sizeof g_szSomething]; 
For example it can be like

Quote:
First = true
Second = false
Third = true
That's why.

Last edited by ~Ice*shOt; 11-29-2014 at 11:26.
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-29-2014 , 13:34   Re: nVault
Reply With Quote #3

You can make a loop to append a 1 or a 0 for each one.
__________________
fysiks is offline
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 11-29-2014 , 13:45   Re: nVault
Reply With Quote #4

This is my attempt, is it okay? Will it save and load data correctly and is it the best way?

PHP Code:
public SaveData(id)
{
    new 
szData[16], szData2[32];
    new 
szKey[40];
 
    
formatex(szKeycharsmax(szKey), "%s-AuthID"g_szAuthID[id]);
    
formatex(szDatacharsmax(szData), "%i#%i#"g_iVar1[id], g_iVar2[id]);

    for (new 
0sizeof g_szSomethingi++)
        
formatex(szData2charsmax(szData2), "%i#"g_bTrue[id][i] ? 0);

    
nvault_set(g_VaultszKeyszData);
    
nvault_set(g_VaultszKeyszData2);
}

public 
LoadData(id)
{
    new 
szData[16], szData2[32];
    new 
szKey[40];
 
    
formatex(szKeycharsmax(szKey), "%s-AuthID"g_szAuthID[id]);
    
formatex(szDatacharsmax(szData), "%i#%i#"g_iVar1[id], g_iVar2[id]);

    for (new 
0sizeof g_szSomethingi++)
        
formatex(szData2charsmax(szData2), "%i#"g_bTrue[id][i] ? 0);

    
nvault_get(g_VaultszKeyszDatacharsmax(szData));
    
nvault_get(g_VaultszKeyszData2charsmax(szData2));

    
replace_all(szData255"#"" ")
    
replace_all(szData2255"#"" ")

    new 
szVar1[32], szVar2[32];
    
parse(szDataszVar1charsmax(szVar1), szVar2charsmax(szVar2));
 
    
g_iVar1[id] = str_to_num(szVar1);
    
g_iVar2[id] = str_to_num(szVar2);

    for (new 
0sizeof g_szSomethingi++)
    {
        new 
szTrue[32]
        
parse(szData2szTruecharsmax(szTrue));
 
        
g_bTrue[id][i] = str_to_num(szTrue);
    }

~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
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 17:42.


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