Raised This Month: $ Target: $400
 0% 

nvault not setting or getting properly


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Venomxtinct
Member
Join Date: Nov 2005
Old 09-03-2008 , 22:38   nvault not setting or getting properly
Reply With Quote #1

For some reason, no matter what I try, I cannot get the nvault to store/recall the data properly. I dont know what it is after three code re-writes, thus I am asking for help.

I know theres a lot of room for optimization, however for now I just want to get it to work properly..

The problem occurs when I say /credits after a disconnect. When I reconnect, the credits are reset to zero, thus making it kinda obsolete. Im pretty sure its either:
Problem with the nvault_get
Problem with the nvault_set
Mis-used variable to the nvault

Help would be greatly appreciated.

Update:
I just found the nvault viewer and apparently its not writing or getting. Making me so confused.

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <engine> #include <cstrike> #include <fun> #include <nvault> #define PLUGIN "nAcHo's Special Weapon Mod" #define VERSION "0.02" #define AUTHOR "nAcHo cHeEsE" new last_playtime_check[33] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /credits", "credits_say")     register_clcmd("say_team /credits", "credits_say")     register_clcmd("say credits", "credits_say")     register_clcmd("say creds", "credits_say") } public client_putinserver(id) {     new authid[32]     get_user_authid(id, authid, 34)     //get the time spent playing     new time_playing     time_playing = (get_user_time(id) - last_playtime_check[id])     last_playtime_check[id] = get_user_time(id)         //NVAULT     //vault_set = the previous vault value     new nvault = nvault_open("CreditsMod23")     new vault_set[32], prev_vault_set     nvault_get(nvault, authid, vault_set[id])     prev_vault_set = str_to_num(vault_set[id])     vault_set[id] = prev_vault_set + time_playing     num_to_str(vault_set[id], vault_set[id], 34)     nvault_set(nvault, authid, vault_set[id])     //END NVAULT } public credits_say(id) {         //get the authid     new authid[32]     get_user_authid(id, authid, 34)         //get the time spent playing     new time_playing     time_playing = (get_user_time(id) - last_playtime_check[id])     last_playtime_check[id] = get_user_time(id)                 new nvault = nvault_open("CreditsMod23")     new vault_set[32], prev_vault_set     nvault_get(nvault, authid, vault_set[id], 34)     prev_vault_set = str_to_num(vault_set[id])     vault_set[id] = prev_vault_set + time_playing     num_to_str(vault_set[id], vault_set[id], 34)     nvault_set(nvault, authid, vault_set[id])         nvault_get(nvault, authid, vault_set[id], 34)     new credits     credits = str_to_num(vault_set[id])     client_print(id, print_chat, "You have %i Credits", credits) } public client_disconnect(id) {                 //get the authid     new authid[32]     get_user_authid(id, authid, 34)         //get the time spent playing     last_playtime_check[id] = 0     new time_playing     time_playing = (get_user_time(id) - last_playtime_check[id])                 new nvault = nvault_open("CreditsMod23")     new vault_set[32], prev_vault_set     nvault_get(nvault, authid, vault_set[id], 34)     prev_vault_set = str_to_num(vault_set[id])     vault_set[id] = prev_vault_set + time_playing     num_to_str(vault_set[id], vault_set[id], 34)     nvault_set(nvault, authid, vault_set[id]) }

Last edited by Venomxtinct; 09-04-2008 at 17:34.
Venomxtinct 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 03:18.


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