Raised This Month: $ Target: $400
 0% 

SaveXP


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 05-23-2009 , 05:06   SaveXP
Reply With Quote #1

what i can save a lavel, xp?
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
--kml--
Senior Member
Join Date: Jan 2009
Old 05-23-2009 , 07:00   Re: SaveXP
Reply With Quote #2

:O you can get it from here xD

a tuto about exp xD

http://forums.alliedmods.net/showthread.php?t=12518

some parts

from it

Quote:
Now lets create a function to save XP with.
(XP gets loaded from amxmodx/data/vault.ini)
PHP Code:
     public SaveXP(id)
{
    new 
authid[32]; 
    
get_user_authid(id,authid,31); 

    new 
vaultkey[64], vaultdata[64]; 
  
    
//Save their class
    
format(vaultkey,63,"ANIMAL-%s-class",authid); 
    
format(vaultdata,63,"%d",PlayerClass[id]); 
    
set_vaultdata(vaultkey,vaultdata); 

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

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

Now lets create a function to load XP
(XP gets loaded from amxmodx/data/vault.ini)

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

    new 
vaultkey[64], vaultdata[64]; 

    
//Load their class
    
format(vaultkey,63,"ANIMAL-%s-class",authid); 
    
get_vaultdata(vaultkey,vaultdata,63); 
    
PlayerClass[id] = str_to_num(vaultdata); 

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

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

Now that we have a SaveXP and LoadXP function, lets load their XP when they connect.

PHP Code:
      
       
public client_connect(id)
{
    
//Only load their XP if our SaveXP cvar is 1.
    
if(get_cvar_num("SaveXP") == 1) {
       
         
LoadXP(id)

         
//Add a message if you want....
         
client_print(idprint_chat"[Animal Mod] XP Loaded!")
         
client_print(idprint_chat"[Animal Mod] You are a %s with level %s and %s XP"PlayerClass[id], PlayerLevel[id], PlayerXP[id])
    }

Now we save their XP when they disconnect.

PHP Code:
public client_disconnect(id)
{
    
//Only save their XP if our SaveXP cvar is 1.
    
if(get_cvar_num("SaveXP") == 1) {
    
         
SaveXP(id)
    }

and also a tuto on saving data xD

http://forums.alliedmods.net/showthread.php?t=12606


well eventualy to help u more try to read tuto's from here

http://forums.alliedmods.net/forumdi...=83&order=desc
__________________
wooT now is asking season
will ask you plenty of things for learning
--kml-- is offline
padilha007
Senior Member
Join Date: Jul 2008
Old 05-23-2009 , 09:08   Re: SaveXP
Reply With Quote #3

@~Ice*shOt

Search...
__________________

padilha007 is offline
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 01:27.


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