Raised This Month: $ Target: $400
 0% 

usage of nvault


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Speed!
BANNED
Join Date: Jan 2009
Old 02-04-2009 , 01:34   usage of nvault
Reply With Quote #1

hi, im not used to this module, so i have no idea of how to use it.
i wanna save some data like this

name,float,float,float,float
name2,float,float,float,float

so, i want to manage 4 floats based on a name eg:
"THE_KILLER",0,1,2,0
"N00B ASSASSIN",4,2,1,0
etc...
Speed! is offline
TheRadiance
Senior Member
Join Date: Nov 2007
Location: Kazakhstan
Old 02-04-2009 , 04:20   Re: usage of nvault
Reply With Quote #2

PHP Code:
...
#include <amxmodx>
#include <nvault>
...
new 
name[32], fData[16];
get_user_name(idnamesizeof (name) - 1);
format(fDatasizeof (fData) - 1"^"0^" ^"1^" ^"2^" ^"0^"");

new 
nvault nvault_open("nvault_name");
nvault_set(nvaultnamefData);
nvault_close(nvault);
... 
PHP Code:
...
new 
name[32], fData[16];
get_user_name(idnamesizeof (name) - 1);

new 
nvault nvault_open("nvault_name");
nvault_get(nvaultnamefDatasizeof (fData) - 1); - /* After this you will have all player's data in variable "fData" */
nvault_close(nvault);

new 
fVal[2], fVal2[2], fVal3[2], fVal4[2];
parse(fDatafValsizeof (fVal) - 1fVal2sizeof (fVal2) - 1fVal3sizeof (fVal3) - 1fVal4sizeof (fVal4) - 1); - /* After this you will have every value from "fData" in the allocated variable. */
... 

Last edited by TheRadiance; 02-04-2009 at 04:34.
TheRadiance is offline
Send a message via ICQ to TheRadiance
Speed!
BANNED
Join Date: Jan 2009
Old 02-04-2009 , 12:43   Re: usage of nvault
Reply With Quote #3

Quote:
Originally Posted by TheRadiance View Post
PHP Code:
...
#include <amxmodx>
#include <nvault>
...
new 
name[32], fData[16];
get_user_name(idnamesizeof (name) - 1);
format(fDatasizeof (fData) - 1"^"0^" ^"1^" ^"2^" ^"0^"");

new 
nvault nvault_open("nvault_name");
nvault_set(nvaultnamefData);
nvault_close(nvault);
... 
PHP Code:
...
new 
name[32], fData[16];
get_user_name(idnamesizeof (name) - 1);

new 
nvault nvault_open("nvault_name");
nvault_get(nvaultnamefDatasizeof (fData) - 1); - /* After this you will have all player's data in variable "fData" */
nvault_close(nvault);

new 
fVal[2], fVal2[2], fVal3[2], fVal4[2];
parse(fDatafValsizeof (fVal) - 1fVal2sizeof (fVal2) - 1fVal3sizeof (fVal3) - 1fVal4sizeof (fVal4) - 1); - /* After this you will have every value from "fData" in the allocated variable. */
... 
thank you very much
its really easy and usefull
Speed! is offline
Speed!
BANNED
Join Date: Jan 2009
Old 02-04-2009 , 16:52   Re: usage of nvault
Reply With Quote #4

how should i use this
PHP Code:
    new name[32], fData[16]
    
get_user_name(idnamesizeof (name) - 1)
    
    new 
nvault nvault_open("nvault_zp")
    
nvault_get(nvaultnamefDatasizeof (fData) - 1)
    
nvault_close(nvault)
    
    new 
fVal[2], fVal2[2], fVal3[2], fVal4[2]
    
parse(fDatafValsizeof (fVal) - 1fVal2sizeof (fVal2) - 1fVal3sizeof (fVal3) - 1fVal4sizeof (fVal4) - 1)
    
g_lvlhp[id] = fVal
    g_lvlspeed
[id] = fVal2
    g_lvlgravity
[id] = fVal3
    g_lvlremaining
[id] = fVal4 
i mean because of the "must be assigned to an array"
i want g_lvlhp and them, to be the number saved. ie 2 but fVal2 is a string.

edit: done i think (str_to_num)

Last edited by Speed!; 02-04-2009 at 16:56.
Speed! is offline
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 02-04-2009 , 16:57   Re: usage of nvault
Reply With Quote #5

if you put new g_lvlhp[33][2]

You can copy one array to other like this
g_lvlhp[id] = fVal

if not... You can use

copy(g_lvlhp[id], 1, fVal)

and if fVal is a number you can use

g_lvlhp[id] = str_to_num(fVal)
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
Speed!
BANNED
Join Date: Jan 2009
Old 02-04-2009 , 17:37   Re: usage of nvault
Reply With Quote #6

Quote:
Originally Posted by AntiBots View Post
if you put new g_lvlhp[33][2]

You can copy one array to other like this
g_lvlhp[id] = fVal

if not... You can use

copy(g_lvlhp[id], 1, fVal)

and if fVal is a number you can use

g_lvlhp[id] = str_to_num(fVal)
thanks allthough i allready solved with str_to_num
Speed! 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 01:39.


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