Raised This Month: $ Target: $400
 0% 

Plugin end


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ex3cuTioN
Member
Join Date: May 2010
Old 08-01-2010 , 04:13   Plugin end
Reply With Quote #1

I have a xp mod, based on jumping

When the player disconnects from the servers the xp is saving
When he is connecting the xp is loading

But when the map change the xp goes to 0

how can i put

PHP Code:
public plugin_end(){
    
SaveData(id);
    
nvault_close(g_vault);

PHP Code:
public SaveData(id) { 
    new 
vaultkey[45];
    new 
vaultdata[12];

    
format(vaultkey,44,"%s-Mod",g_szAuthID[id]);
    
format(vaultdata,11,"%d %d",PlayerXP[id],PlayerLevel[id]);

    
nvault_set(g_vault,vaultkey,vaultdata);

PHP Code:
public LoadData(id) {
    new 
vaultkey[45];
    new 
vaultdata[12];

    
format(vaultkey,44,"%s-Mod",g_szAuthID[id]);
    
    if(
nvault_get(g_vault vaultkey vaultdata 11)) {
        new 
iSpacePos containvaultdata ," ");
        
        if ( 
iSpacePos > -)
        {
            new 
playerxp[12];
            new 
playerlevel[4];
            
            
formatexplayerxp iSpacePos "%s" vaultdata );
            
formatexplayerlevel "%s" vaultdata[iSpacePos 1]);
            
            
PlayerXP[id] = str_to_num(playerxp);
            
PlayerLevel[id] = str_to_num(playerlevel);
        }
    }
    else {
        
ColorChat(id,GREEN,"[PuncteExperienta]^x01 Nu ai puncte salvate in baza de date");
    }


Last edited by Ex3cuTioN; 08-01-2010 at 04:57.
Ex3cuTioN is offline
Vechta
Veteran Member
Join Date: Jun 2010
Old 08-01-2010 , 04:25   Re: Plugin end
Reply With Quote #2

Loaddata(id) ?
Vechta is offline
Ex3cuTioN
Member
Join Date: May 2010
Old 08-01-2010 , 04:57   Re: Plugin end
Reply With Quote #3

See first post
Ex3cuTioN is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-01-2010 , 08:10   Re: Plugin end
Reply With Quote #4

If you have that save code in plugin_end(), remove it (but leave the nvault_close() code there). client_disconnect() is called on all clients @ mapchange so save client data there. Also, use formatex() in the save function instead of format().
__________________
Bugsy is offline
Ex3cuTioN
Member
Join Date: May 2010
Old 08-01-2010 , 09:34   Re: Plugin end
Reply With Quote #5

Zomfg

for 2 letters i sped hours in trying to solve that

Thanks a LOOT

EDIT:Hey what about this

PHP Code:
/* Called when the mod tries to change the map. */
forward server_changelevel(map[]); 

Last edited by Ex3cuTioN; 08-01-2010 at 12:46.
Ex3cuTioN 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 00:14.


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