Raised This Month: $ Target: $400
 0% 

Saving Xp and Level.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
SaM.ThE.MaN
Senior Member
Join Date: Jan 2010
Old 05-24-2010 , 14:17   Saving Xp and Level.
#1

Hi,

I am making a plugin and i am having a problem saving and loading xp and level. Here is the code i am using :
PHP Code:
 TO save 
public 
SaveXP(id)
{
    new 
authid[32]; 
    
get_user_authid(id,authid,31); 

    new 
vaultkey[64], vaultdata[64]; 

    
//Save their XP
    
format(vaultkey,63,"Level-%s-xp",authid); 
    
format(vaultdata,63,"%d",PlayerXP[id]); 
    
set_vaultdata(vaultkey,vaultdata); 

    
//Save their level
    
format(vaultkey,63,"Level-%s-level",authid); 
    
format(vaultdata,63,"%d",PlayerLevel[id]); 
    
set_vaultdata(vaultkey,vaultdata);

PHP Code:
 To load:
public 
LoadXP(id)
{
    new 
authid[32]; 
    
get_user_authid(id,authid,31); 

    new 
vaultkey[64], vaultdata[64]; 

     
//Load their XP
    
format(vaultkey,63,"Level-%s-xp",authid); 
    
get_vaultdata(vaultkey,vaultdata,63); 
    
PlayerXP[id] = str_to_num(vaultdata);   

    
//Load their level
    
format(vaultkey,63,"Level-%s-level",authid); 
    
get_vaultdata(vaultkey,vaultdata,63);
    
PlayerLevel[id] = str_to_num(vaultdata);  

But each time i close and open the server the info gets deleted, i want it to stay on for ever each time i connect open and close the server.
Help
SaM.ThE.MaN 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 05:19.


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