Quote:
Originally Posted by bwgrubbs1
ok...i will stick with nVault then, its not a lot of data just numbers for people...back to the whole saving with steam ID then...can i do that in nVault and how do I modify the code above to save in nVault with Steam ID ?
|
Code:
public client_putinserver(id)
{
//blah blah other stuff
// then this
load_points(id)
}
here is my load points function.
Code:
public load_points(id)
{
new vault = nvault_open("points")
if(vault == INVALID_HANDLE)
set_fail_state("nVault returned invalid handle")
//new key[100], ip[33]
new key[100], authid[33] // for saving by authid/steamid
//get_user_ip(id, ip, 32, 1);
get_user_authid(id, authid, 32)
//formatex(key, 99,"%s-points", ip)
formatex(key, 99,"%s-points", authid)
points[id] = nvault_get(vault, key)
nvault_close(vault)
return PLUGIN_CONTINUE;
}
then on disconnect...
Code:
public client_disconnect(id)
{
save_points(id)
}
here is the save points function
Code:
public save_points(id)
{
new vault = nvault_open("points")
if(vault == INVALID_HANDLE)
set_fail_state("nVault returned invalid handle")
//new key[62], value[10], ip[33]
new key[62], value[10], authid[33]
//get_user_ip(id, ip, 32, 1);
get_user_authid(id, authid, 32)
//format(key, 61,"%s-points", ip)
format(key, 61,"%s-points", authid)
format(value, 9,"%d", points[id])
nvault_set(vault, key, value)
nvault_close(vault)
return PLUGIN_CONTINUE;
}
There you are - I commented out the old code exactly as it was and added in the authid/steamid code to replace it to save by authid/steamid rather than IP address.
Slmclarengt
__________________