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

fvault_get_data() strange problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 02-03-2015 , 13:04   fvault_get_data() strange problem
Reply With Quote #1

Hey, guys! I was going to make a plugin, and apparetnly that became harder than I thought. The question is, that it doesn't even make a sense. So, I'll explain as short as possible. I have the following fvault file:
Code:
"Key1" ""Admin1" "Reason1""
"Key2" ""Admin2" "Reason2""
"Key3" ""Admin3" "Reason3""
"Key4" ""Admin4" "Reason4""
"Key5" ""Admin5" "Reason5""
"Key6" ""Admin6" "Reason6""
"Key7" ""Admin7" "Reason7""
And then there is the following code, just to loop a bit that fvault:
PHP Code:
#include <amxmodx>
#include <fvault>

new const g_szFvaultName[] = "MyFvaultFile"

enum _:g_eWarnings
{
    
admin_name[32],
    
reason[128]
}

public 
plugin_init()
{
    
loopFile()
}

stock loopFile()
{
    new 
aData[g_eWarnings]
    new 
szData[528], szKey[35]
    
    for(new 
ifvault_size(g_szFvaultName); i++)
    {
        
fvault_get_keyname(g_szFvaultNameiszKeycharsmax(szKey))
        
log_amx("Keyname: %s"szKey)
        
fvault_get_data(g_szFvaultNameszKeyszDatacharsmax(szData))
        
log_amx("szData: %s"szData)
        
parse(szDataaData[admin_name], charsmax(aData[admin_name]), aData[reason], charsmax(aData[reason]))
        
log_amx("Admin: %s | Reason: %s"aData[admin_name], aData[reason])
    }

The strange thing is, that the szData actually stays empty, and I have no explanation of it... Here is the output in the log after starting:
Code:
L 02/03/2015 - 20:04:25: -------- Mapchange to de_dust2 --------
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] Keyname: Key1
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] szData: 
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] Admin:  | Reason: 
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] Keyname: Key2
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] szData: 
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] Admin:  | Reason: 
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] Keyname: Key3
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] szData: 
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] Admin:  | Reason: 
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] Keyname: Key4
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] szData: 
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] Admin:  | Reason: 
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] Keyname: Key5
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] szData: 
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] Admin:  | Reason: 
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] Keyname: Key6
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] szData: 
L 02/03/2015 - 20:04:25: [WarningSystem.amxx] Admin:  | Reason:
It's so strange... Any suggestions why is that happening?
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-03-2015 , 13:32   Re: fvault_get_data() strange problem
Reply With Quote #2

My guess is the double quotes. Fix the data and it'll probably work how you want.

"Key1" ""Admin1" "Reason1""

It probably sees the below, just a guess though since I don't know how fvault parses.
"Key1"
""
" "
__________________

Last edited by Bugsy; 02-03-2015 at 13:39.
Bugsy is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 02-03-2015 , 13:35   Re: fvault_get_data() strange problem
Reply With Quote #3

It's not from it. Tried with/wihout it, it was that way when I used the fvault_set_data() firstly. So it's not from that... It's like the whole in the brackets is the data parameter, and it's separated with another brackets, so I can parse it.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-03-2015 , 13:52   Re: fvault_get_data() strange problem
Reply With Quote #4

I can take a look at the fvault include when I get home later.
__________________
Bugsy is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 02-03-2015 , 14:05   Re: fvault_get_data() strange problem
Reply With Quote #5

Thanks, dude! I'd really appreciate that, since I don't seem to have another option to do that.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-03-2015 , 14:52   Re: fvault_get_data() strange problem
Reply With Quote #6

What exactly do you need to do in your plugin?
__________________
Bugsy is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 02-03-2015 , 14:56   Re: fvault_get_data() strange problem
Reply With Quote #7

I have a trie, in which I save an array with couple of strings. It's a warn system for admins, to warn players on the server. And еаch player will have a chronologi of his offenses and law breaks. And when a player gets a warn, I add the data in the trie and save it then in the fvault. In plugin_init I loop the fvault (in the same way, but just putting the aData[] array in the trie at the end) and the data should be again in the trie. But I'm stuck on that problem with data getting from fvault...
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-03-2015 , 15:01   Re: fvault_get_data() strange problem
Reply With Quote #8

I was looking for more of a technical explanation. So you need to read from vault when player connects to get his saved string(s), then when he disconnects, save his complete trie of strings? Read them again if he reconnects..? Is the overall goal to save a list of strings for players between connections?
__________________

Last edited by Bugsy; 02-03-2015 at 15:13.
Bugsy is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 02-03-2015 , 15:35   Re: fvault_get_data() strange problem
Reply With Quote #9

Not only between connections, but also on mapchanges and crashes and other unexpected cases of stopping the server. I mean, I just want to have the data in a file, from where it can be taken anytime and will be good saved. And I'm not getting the data on each reconnect, just once in plugin_init and save it in a trie, from where I use the keys to get the data for each player. But that with the fvault is unexplainable for me, should work without problems...
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-03-2015 , 15:39   Re: fvault_get_data() strange problem
Reply With Quote #10

Well yea, what I meant by between connections is to an external file where it can be retrieved. Are you only reading data for players on the server (so STEAMID is available as the key)? Are you open to any other methods or do you want to stick with fvault?
__________________
Bugsy is offline
Reply



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 09:25.


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