Raised This Month: $32 Target: $400
 8% 

FVAULT nullifies saved strings in txt problem


Post New Thread Reply   
 
Thread Tools Display Modes
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
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-09-2020 , 14:46   Re: FVAULT nullifies saved strings in txt problem
Reply With Quote #2

Load the data in client_connect() without any tasks.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
hellmoss
Senior Member
Join Date: Oct 2009
Location: ZOMBIE PLAGUE
Old 06-09-2020 , 18:04   Re: FVAULT nullifies saved strings in txt problem
Reply With Quote #3

I tried but it doesn't seem to be the case
__________________
Quote:
Originally Posted by Kakarot47 View Post
There is no bug. with 100% gurenty
hellmoss is offline
condoriano90
Member
Join Date: May 2020
Old 06-10-2020 , 05:34   Re: FVAULT nullifies saved strings in txt problem
Reply With Quote #4

Try logging (amx_log or something) after fvault_get_data and fvault_set_data and check the log files after a couple days to see when exactly the data becomes "0 0 0" then you can proceed from there
condoriano90 is offline
hellmoss
Senior Member
Join Date: Oct 2009
Location: ZOMBIE PLAGUE
Old 06-11-2020 , 05:24   Re: FVAULT nullifies saved strings in txt problem
Reply With Quote #5

Quote:
Originally Posted by condoriano90 View Post
Try logging (amx_log or something) after fvault_get_data and fvault_set_data and check the log files after a couple days to see when exactly the data becomes "0 0 0" then you can proceed from there
Orgasm.

Problem was in client_disconnected() which calls a double save sometimes, and the second save has "0 0 0" sequence because it's getting in-game data for a client while he isn't in server so it probably returns 0. Also I would suspect client_disconnected() might be executed more than once to a player when they have to download a server resource on map change even if they're not a newcomer thus causing the problem there too.
__________________
Quote:
Originally Posted by Kakarot47 View Post
There is no bug. with 100% gurenty

Last edited by hellmoss; 06-11-2020 at 05:25.
hellmoss is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-11-2020 , 05:47   Re: FVAULT nullifies saved strings in txt problem
Reply With Quote #6

Which AMXX version are you using?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
hellmoss
Senior Member
Join Date: Oct 2009
Location: ZOMBIE PLAGUE
Old 06-11-2020 , 06:15   Re: FVAULT nullifies saved strings in txt problem
Reply With Quote #7

1.10.5388
__________________
Quote:
Originally Posted by Kakarot47 View Post
There is no bug. with 100% gurenty
hellmoss 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 00:41.


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