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 = contain( vaultdata ," ");
if ( iSpacePos > -1 )
{
new playerxp[12];
new playerlevel[4];
formatex( playerxp , iSpacePos , "%s" , vaultdata );
formatex( playerlevel , 3 , "%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");
}
}