Raised This Month: $ Target: $400
 0% 

nValut Save and Load help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
CreePs
Member
Join Date: Mar 2011
Old 12-23-2011 , 10:13   nValut Save and Load help
Reply With Quote #1

this not save or load and i don't know why..
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>

new g_vault;

new 
g_authid[33];

new 
Credits[33];
new 
Health[33];
new 
Armor[33];
new 
hStamina[33];
public 
plugin_init()
{
    
g_vault nvault_open("upgrade");
}

public 
client_authorized(client)
{
    if( !
is_user_bot(client) && !is_user_hltv(client) )
    {
        
get_user_authid(clientg_authid[client], sizeof(g_authid[]) - 1);
        
        
Load(client);
    }
}

public 
client_disconnect(client)
{
    
Save(client);
}

public 
plugin_end()
{
    
nvault_close(g_vault);
}

Load(client)
{
    static 
data[256], timestamp;
    if (
equali(g_authid[client], "STEAM_ID_LAN"))
    {
        new 
ip[64]
        
get_user_ipclientipsizeof(ip) - 1)
        
        if( 
nvault_lookup(g_vaultipdatasizeof(data) - 1timestamp) )
        {
            
ParseLoadData(clientdata);
            return;
        }
        else
        {
            
NewUser(client);
            return;
        }
    } 
    else
    {
        if( 
nvault_lookup(g_vaultg_authid[client], datasizeof(data) - 1timestamp) )
        {
            
ParseLoadData(clientdata);
            return;
        }
        else
        {
            
NewUser(client);
            return;
        }
    }
}

ParseLoadData(iddata[256])
{
    new 
num]
     
    
strbreakdatanumsizeofnum ) - 1datasizeofdata ) - )
    
Creditsid ] = str_to_numnum )
     
    
strbreakdatanumsizeofnum ) - 1datasizeofdata ) - )
    
Healthid ] = str_to_numnum )

    
strbreakdatanumsizeofnum ) - 1datasizeofdata ) - )
    
Armorid ] = str_to_numnum 
     
    
strbreakdatanumsizeofnum ) - 1datasizeofdata ) - )
    
hStaminaid ] = str_to_numnum )
}

NewUser(client)
{
    
Credits[client] = 0;
    
Health[client] = 0;
    
Armor[client] = 0;
    
hStamina[client] = 0;
}

Save(client)
{
    static 
data[256];
    new 
len formatex(datasizeof(data) - 1"%i"Credits[client])
    
    
len += formatex(datasizeof(data) - len 1" %i"Health[client]);
    
    
len += formatex(datasizeof(data) - len 1" %i"Armor[client]);
    
    
len += formatex(datasizeof(data) - len 1" %i"hStamina[client]);
    
    
nvault_set(g_vaultg_authid[client], data);

CreePs 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 12:01.


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