Raised This Month: $ Target: $400
 0% 

nVault help.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mandiii
Junior Member
Join Date: Jun 2010
Old 06-13-2010 , 14:52   nVault help.
Reply With Quote #1

When someone dies their kills/deaths is stored in a vault.
PHP Code:
public client_death(killervictimwpnindexhitplaceTK)
{
    new 
szKills[4];
    new 
szDeaths[4];
    new 
szKey[40];
    new 
szKeyTwo[40];
    
    
formatex(szKey39"%sKILLS"g_szAuthID[killer]);
    
formatex(szKeyTwo39"%sDEATHS"g_szAuthID[victim]);
    
    
formatex(szKills3"%d"get_user_frags(killer));
    
formatex(szDeaths3"%d"get_user_deaths(victim));
    
    
nvault_set(g_VaultszKeyszKills);
    
nvault_set(g_VaultszKeyTwoszDeaths);

I get the values this way:
PHP Code:
    new szKey[40];
    
formatex(szKey39"%sKILLS"g_szAuthID[id]);
    new 
iKills nvault_get(g_VaultszKey); 
PHP Code:
    new szKey[40];
    
formatex(szKey39"%sDEATHS"g_szAuthID[id]);
    new 
iDeaths nvault_get(g_VaultszKey); 
How should i do to get both Deaths and Kills in the same function as seperate variables?
Mandiii is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 06-13-2010 , 14:58   Re: nVault help.
Reply With Quote #2

PHP Code:
// to save 
formatex(datasizeof(data)-1,"%i %i"killsdeaths)

// when loading
new kills[10],deaths[10]
new 
ikillsideaths
parse
(datakillssizeof(kills)-1deathssizeof(deaths)-1)

ikills str_to_num(kills)
ideaths str_to_num(deaths
__________________
I am out of order!
grimvh2 is offline
Mandiii
Junior Member
Join Date: Jun 2010
Old 06-13-2010 , 15:06   Re: nVault help.
Reply With Quote #3

Quote:
Originally Posted by grimvh2 View Post
PHP Code:
// to save 
formatex(datasizeof(data)-1,"%i %i"killsdeaths)

// when loading
new kills[10],deaths[10]
new 
ikillsideaths
parse
(datakillssizeof(kills)-1deathssizeof(deaths)-1)

ikills str_to_num(kills)
ideaths str_to_num(deaths
So if i just put it like this then it will work?
PHP Code:
public cmdGetDeathsNKills(id)
{
    new 
kills[10],deaths[10]
    new 
ikillsideaths
    parse
(datakillssizeof(kills)-1deathssizeof(deaths)-1)

    
ikills str_to_num(kills)
    
ideaths str_to_num(deaths)
    
    
client_print(idprint_chat"You have %d kills and %d deaths"ikillsideaths)

Mandiii is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 06-13-2010 , 15:20   Re: nVault help.
Reply With Quote #4

U still gotta use nvault lal, only gave u an example of how u should load and save ur datas.
and I dont see why u need 2 keys for kills and deaths. U can easely put it into 1 key.
__________________
I am out of order!
grimvh2 is offline
Mandiii
Junior Member
Join Date: Jun 2010
Old 06-13-2010 , 15:24   Re: nVault help.
Reply With Quote #5

Quote:
Originally Posted by grimvh2 View Post
U still gotta use nvault lal, only gave u an example of how u should load and save ur datas.
and I dont see why u need 2 keys for kills and deaths. U can easely put it into 1 key.
Could you give me a fully working example then? Preferrebly compatible with my approach.
Mandiii is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 06-13-2010 , 15:41   Re: nVault help.
Reply With Quote #6

PHP Code:
// save
new szData[64], szAuthid[32]
get_user_authid(idszAuthidsizeof(szAuthid)-1)

formatex(szDatasizeof(szData)-1,"%i %i"get_user_frags(id), cs_get_user_deaths(id))

nvault_set(g_VaultszAuthidszData); 

//load

new szData[64], szAuthid[32], szKills[10], szDeaths[10], kills,deaths
get_user_authid
(idszAuthidsizeof(szAuthid)-1)
nvault_get(g_VaultszAuthidszData); 

parse(szDataszKills9szDeaths9)

kills str_to_num(szKills)
deaths str_to_num(szDeaths
Get it now? (didnt test that so might have typos)
Note : i prefer using fvault (from exolents tut)
__________________
I am out of order!

Last edited by grimvh2; 06-13-2010 at 15:44.
grimvh2 is offline
Mandiii
Junior Member
Join Date: Jun 2010
Old 06-13-2010 , 15:44   Re: nVault help.
Reply With Quote #7

EDIT: Saw that you edited it now.
Mandiii is offline
Reply


Thread Tools
Display Modes

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 14:52.


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