I have the following code:
Code:
public login(id)
{
new steamid[34]
get_user_authid(id,steamid,33)
new key_kills[129],key_name[129]
format(key_kills,128,"%s%s%s",PLUGIN,KILLS,steamid)
format(key_name,128,"%s%s%s",PLUGIN,NAME,steamid)
if(vaultdata_exists(key_kills))
{
if (change_name(id))
{
has_character[id]=true
return 1
}
} else
{
set_vaultdata(key_kills,"0")
new name[21]
get_user_name(id,name,20)
set_vaultdata(key_name,name)
if (change_name(id))
{
has_character[id]=true
return 1
}
}
return 0
}
If I call login() at any given time (and it's already been called before on this player),
if(vaultdata_exists(key_kills)) evaluates as true. The same is true if I/the player disconnect/s from the server and reconnect/s a few minutes later.
If, however, I change the map (using map, changelevel, or amx_map) and call login() on a player,
if(vaultdata_exists(key_kills)) is presumably evaluated as false, because the data in the vault (which, up until login() is called, still exists) is overtwritten (setting kills back to 0).
I've exausted my brain and I still can't figure out why this is happening - any clues?
[edit] Apparently ftp was being stupid, and the vault is actually being rebuilt on mapchange..
Isn't the vault supposed to stay between maps?
[edit2] no, it's being rebuilt when login() is called, but only after a mapchange...
wtf!?