Raised This Month: $ Target: $400
 0% 

nVault


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 11-29-2014 , 13:45   Re: nVault
Reply With Quote #1

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


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