I need to save and load data by authid and name.
PHP Code:
public save_xp(id)
{
new authid[35]
get_user_authid(id,authid,34)
new name[35]
get_user_name(id,name,34)
new vaultkey[64],vaultdata[96]
formatex(vaultkey,63,"%s-%s-SSTATS",authid,name)
formatex(vaultdata,95,"%i#%i",kills[id],deaths[id])
set_vaultdata(vaultkey,vaultdata)
}
The save seems to work as I can see it in my vault file. However the following which is the loading process doesn't seem to be working... any ideas? Thanks in advance.
PHP Code:
public load_xp(id)
{
new authid[35]
get_user_authid(id,authid,34)
new name[35]
get_user_name(id,name,34)
new vaultkey[64],vaultdata[96]
formatex(vaultkey,63,"%s-%s-SSTATS",authid,name)
if(vaultdata_exists(vaultkey))
{
get_vaultdata(vaultkey,vaultdata,95)
replace_all(vaultdata,95,"#"," ")
new pre_kills[8],pre_deaths[8]
parse(vaultdata,pre_kills,7,pre_deaths,7)
kills[id]=str_to_num(pre_kills)
deaths[id]=str_to_num(pre_deaths)
}
else
{
kills[id]=0
deaths[id]=0
}
}
__________________