AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Plugin end (https://forums.alliedmods.net/showthread.php?t=134117)

Ex3cuTioN 08-01-2010 04:13

Plugin end
 
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");
    }



Vechta 08-01-2010 04:25

Re: Plugin end
 
Loaddata(id) ?

Ex3cuTioN 08-01-2010 04:57

Re: Plugin end
 
See first post

Bugsy 08-01-2010 08:10

Re: Plugin end
 
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().

Ex3cuTioN 08-01-2010 09:34

Re: Plugin end
 
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[]); 



All times are GMT -4. The time now is 00:14.

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