Raised This Month: $ Target: $400
 0% 

gvault help?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
craigy09
Senior Member
Join Date: Mar 2010
Old 05-16-2010 , 03:50   gvault help?
Reply With Quote #1

hi im having trouble with this code. rightn ow it saves via name. i want it to save/load via steamid? dont worry about the language hehe.

Code:
//SAVE
public ZapiszDane(id)
{
    new vaultkey[64],vaultdata[256];
    format(vaultkey,63,"%s-%i-cod", name_player[id], class_player[id]);
    format(vaultdata,255,"%i#%i#%i#%i#%i#%i", experience_player[id], level_player[id], inteligencja_player[id], zdrowie_player[id], wytrzymalosc_player[id], kondycja_player[id]);
    nvault_set(g_vault,vaultkey,vaultdata);
}
// LOAD
public WczytajDane(id, class)
{
    new vaultkey[64],vaultdata[256];
    format(vaultkey,63,"%s-%i-cod", name_player[id], class);
    format(vaultdata,255,"%i#%i#%i#%i#%i#%i", experience_player[id], level_player[id], inteligencja_player[id], zdrowie_player[id], wytrzymalosc_player[id], kondycja_player[id]);
    nvault_get(g_vault,vaultkey,vaultdata,255);
 
    replace_all(vaultdata, 255, "#", " ");
 
    new experienceplayer[32], levelplayer[32], inteligencjaplayer[32], silaplayer[32], zrecznoscplayer[32], zwinnoscplayer[32];
 
    parse(vaultdata, experienceplayer, 31, levelplayer, 31, inteligencjaplayer, 31, silaplayer, 31, zrecznoscplayer, 31, zwinnoscplayer, 31);
 
    experience_player[id] = str_to_num(experienceplayer);
    level_player[id] = str_to_num(levelplayer)>0?str_to_num(levelplayer):1;
    inteligencja_player[id] = str_to_num(inteligencjaplayer);
    zdrowie_player[id] = str_to_num(silaplayer);
    wytrzymalosc_player[id] = str_to_num(zrecznoscplayer);
    kondycja_player[id] = str_to_num(zwinnoscplayer);
    punkty_player[id] = (level_player[id]-1)*2-inteligencja_player[id]-zdrowie_player[id]-wytrzymalosc_player[id]-kondycja_player[id];
}
craigy09 is offline
JaGareN
Senior Member
Join Date: Mar 2009
Old 05-16-2010 , 09:18   Re: gvault help?
Reply With Quote #2

PHP Code:
new AuthID[33];
 
get_user_authid(idAuthID32); 

Last edited by JaGareN; 05-16-2010 at 09:26. Reason: ...
JaGareN is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-16-2010 , 09:43   Re: gvault help?
Reply With Quote #3

Create a global array of strings to hold the users authid.

new g_szAuthID[ 33 ][ 34 ];

In client_authorized:

get_user_authid( id , g_szAuthID[ id ] , charsmax( g_szAuthID[] ) );

In your two functions above, replace name_player[id] with g_szAuthID[id] when formatting your key.
__________________

Last edited by Bugsy; 05-16-2010 at 09:50.
Bugsy is offline
NiQu
Veteran Member
Join Date: Nov 2009
Old 05-16-2010 , 16:34   Re: gvault help?
Reply With Quote #4

Whats gvault? Gay vault ?
__________________
My Projects
  • RoTAPI V0.0.1 ------- Private
    • Progress - [||||||||||]
  • CashMod V0.0.6 ----- Public
    • Progress - [||||||||||]
  • CashMod V0.0.7 ----- Public
    • Progress - [||||||||||]
NiQu is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 05-16-2010 , 16:43   Re: gvault help?
Reply With Quote #5

Quote:
Originally Posted by NiQu View Post
Whats gvault? Gay vault ?
That was unnecessary. gvault could be just be the name of the variable he is having trouble with. The g(_) is just used to explain to others that the variable is global. Same as all other tags; i for integer, sz for a zero-terminated string, m for a member of a struct. You get it. It goes on forever. It's all a part of a thing called Hungarian Notation.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
NiQu
Veteran Member
Join Date: Nov 2009
Old 05-16-2010 , 17:29   Re: gvault help?
Reply With Quote #6

He/she shud still put nvault in the topic.
__________________
My Projects
  • RoTAPI V0.0.1 ------- Private
    • Progress - [||||||||||]
  • CashMod V0.0.6 ----- Public
    • Progress - [||||||||||]
  • CashMod V0.0.7 ----- Public
    • Progress - [||||||||||]
NiQu is offline
Reply



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 03:55.


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