View Single Post
Author Message
hellmoss
Senior Member
Join Date: Oct 2009
Location: ZOMBIE PLAGUE
Old 06-09-2020 , 12:45   FVAULT nullifies saved strings in txt problem
Reply With Quote #1

[SOLVED]


Hello, I'm using an identical plugin to this one but instead of using parse i use str_to_num and instead of formatex, num_to_str. The plugin which stores only 1 variable in a txt and uses str to num/num to str hasn't had a problem in 10 years.

Using parse and formatex (I'm not really sure this is where the problem comes from)
Taken from my txt: "4h4" "0 1 1" 1591709213

The sequence becomes "0 0 0" but not at all times mainly when one uses 'retry' or map changes.
Again, a person may retry 10 times and still have no problem. Maps may change 5 times and still no problem. But I'm more prone to believe that something happens on map change.
The default sequence for a newcomer is "1 1 0". Even if they dont touch anything they would get their sequence nullified in some inexplicable occasion.

Tried with 3 people in server, spamming map change and people retrying, changing their sequence, not changing it, you name it. Most times it does save the sequence on loading data but sometimes it doesn't.. What gives???

Code:
#include <amxmodx>
#include <fvault>
#include <zpclass>

new const g_vault[] = "personal"

new g_cdown[33], g_usnd[33], g_wide[33]

public plugin_init()
	register_plugin("save personaliz.", "1.0", "h3LLm0sS")

public client_putinserver(id)
{
	//set_task(0.1, "Load", id)
	Load(id)
	//set_task(300.0, "Save", id, _, _, "b")
}

public Load(id)
{
	if(is_user_hltv(id) || is_user_bot(id) || !is_user_connected(id))
		return

	new data[6], name[32]
	get_user_name(id, name, charsmax(name))

	if(fvault_get_data(g_vault, name, data, charsmax(data)))
	{
		new tempvar1[10], tempvar2[10], tempvar3[10]
		parse(data, tempvar1, charsmax(tempvar1), tempvar2, charsmax(tempvar2), tempvar3, charsmax(tempvar3))

		g_cdown[id]=str_to_num(tempvar1)
		g_usnd[id]=str_to_num(tempvar2)
		g_wide[id]=str_to_num(tempvar3)

		setdata(id)
	}
}

public client_disconnected(id)
{
	getdata(id)

	new data[6], name[32]
	get_user_name(id, name, charsmax(name))

	formatex(data, charsmax(data), "%d %d %d", g_cdown[id], g_usnd[id], g_wide[id])
	fvault_set_data(g_vault, name, data)
}

public getdata(id)
{
	g_cdown[id]=zp_get_cdown1(id)
	g_usnd[id]=zp_get_usound(id)
	g_wide[id]=zp_get_fov(id)
}

public setdata(id)
{
	if(!g_cdown[id])
		zp_toggle_cdown1(id)

	if(!g_usnd[id])
		zp_ultimate_toggle(id)

	if(g_wide[id])
		zp_human_fov(id)
}
__________________
Quote:
Originally Posted by Kakarot47 View Post
There is no bug. with 100% gurenty

Last edited by hellmoss; 06-11-2020 at 05:26.
hellmoss is offline