Не могу записать данные в nvault файл, через принт читаются нормально.
Подскажите, что я делаю не так?
Подскажите, что я делаю не так?
Код:
#include <amxmodx>
#include <amxconst>
#include <nvault>
#define PLUGIN "Test"
#define VERSION "1.0"
#define AUTHOR "Nbown"
enum Cvars { TEST_NUM, TEST_TEXT, TEST_FLOAT };
enum _: ENUM_DATA
{
TYPE,
TIME
};
enum _: ENUM_DATA_TYPE
{
TYPE_ZERO,
TYPE_ONE,
TYPE_TWO,
TYPE_THREE
};
new g_nVault;
new g_CvarNum;
new g_pCvar[Cvars];
new Float:g_CvarFloat;
new g_CvarStr[4];
new g_szIP[MAX_PLAYERS + 1 char][16];
new Trie: g_tPlayer;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_concmd("test", "Func");
g_pCvar[TEST_NUM] = register_cvar("cvar_num","2");
g_pCvar[TEST_TEXT] = register_cvar("cvar_text","abc");
g_pCvar[TEST_FLOAT] = register_cvar("cvar_float","2.5");
g_CvarNum = get_pcvar_num(g_pCvar[TEST_NUM]);
g_CvarFloat = get_pcvar_float(g_pCvar[TEST_FLOAT]);
get_pcvar_string(g_pCvar[TEST_TEXT], g_CvarStr, 3);
server_print("^nPLUGIN: %s, VERSION: %.1f, AUTHOR: %s", PLUGIN, VERSION, AUTHOR);
server_print("NUM: %d, TEXT: %s, FLOAT: %.1f^n", g_CvarNum, g_CvarStr, g_CvarFloat);
g_tPlayer = TrieCreate();
}
public plugin_cfg()
{
if (g_nVault == INVALID_HANDLE)
set_fail_state("Error opening nVault!");
}
public plugin_end()
{
TrieDestroy(g_tPlayer);
nvault_close(g_nVault);
}
public client_putinserver(id)
{
get_user_ip(id, g_szIP[id], charsmax(g_szIP[]), true);
}
public Func(id)
{
new PLAYER = get_user_userid(id);
new tData[ENUM_DATA_TYPE];
tData[TYPE] = g_CvarNum + 1;
tData[TIME] = (get_systime() + (g_CvarNum * 60));
TrieSetArray(g_tPlayer, g_szIP[PLAYER], tData, sizeof(tData));
new s_Data[32], s_Key[17];
formatex(s_Key, charsmax(s_Data), "%s", g_szIP[PLAYER]);
formatex(s_Data, charsmax(s_Data), "TYPE:%d TIME:%d", tData[TYPE], tData[TIME]);
nvault_set(g_nVault, s_Key, s_Data);
console_print(id, " ");
console_print(id, "handle: %d, key: %s, data_type: %d, data_time: %d", g_tPlayer, g_szIP[PLAYER], tData[TYPE], tData[TIME]);
console_print(id, " ");
}