Raised This Month: $ Target: $400
 0% 

Save using steamid


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
slmclarengt
Veteran Member
Join Date: Jul 2004
Location: The Cookie Jar... or Pul
Old 06-06-2007 , 15:13   Re: Save using steamid
Reply With Quote #7

Quote:
Originally Posted by bwgrubbs1 View Post
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
__________________
But we don’t beat the Reaper by living longer. We beat the Reaper by living well. -Dr. Randy Pausch, R.I.P.

Come play WC3:FT on BnD Clan Server! You know you want to: Connect to WC3:FT BnD - go ahead click me!
slmclarengt is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:33.


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