AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] [fvault] Error in save.. (https://forums.alliedmods.net/showthread.php?t=189948)

pacheco 07-12-2012 18:53

[SOLVED] [fvault] Error in save..
 
I have this code in one plugin

PHP Code:

new szData[20]; 
formatex(szDatacharsmax(szData), "%s %i"g_szTempPassWord[id], g_AP[id])
fvault_set_data("zs_bank_register"g_szTempName[id], szData

When fvault is saved, why is saved like:
Code:

"mylogin" "mypw 0" 1342133388
I want to save like:
Code:

"mylogin" "mypw" "myammopacks" 1342133388
Thanks!

Bugsy 07-12-2012 18:56

Re: [fvault] Error in save..
 
Because thats how you're saving it...formatex(szData, charsmax(szData), "%s %i", g_szTempPassWord[id], g_AP[id])

I don't use fvault so I'm not sure if there is a way to save multiple data items per save. But you can get it to save that way with this, you just need to read it correctly when needed...or leave it as-is and just parse the data.
PHP Code:

formatex(szDatacharsmax(szData), "%s^" ^"%i"g_szTempPassWord[id], g_AP[id]) 


pacheco 07-12-2012 19:06

Re: [fvault] Error in save..
 
Ok Bugsy, thanks!
Now it's saving correctly.

Code:

"lol" "lol" "100" 1342134070

Bugsy 07-12-2012 19:18

Re: [fvault] Error in save..
 
Yes, but next you're going to ask how to read the data.

pacheco 07-12-2012 19:24

Re: [fvault] Error in save..
 
Quote:

Yes, but next you're going to ask how to read the data.
Yes, that's it..

Now, when i'm going to login, my password is wrong..

see the code:

PHP Code:

new data[140]
fvault_get_data"zs_bank_register"g_szTempName[id], data139)

if(
equal(g_szTempPassWord[id], data))
{
    
g_logged[id] = true;


I know it's wrong.. how to fix it?

Bugsy 07-12-2012 19:37

Re: [fvault] Error in save..
 
Don't use what I posted above for saving, use your original code.
PHP Code:

//Save data
new szData[20]; 
formatex(szDatacharsmax(szData), "%s %i"g_szTempPassWord[id], g_AP[id])
fvault_set_data("zs_bank_register"g_szTempName[id], szData)  

//Load data
new data[140] , szPassword128 ] , szVal10 ] , iVal;
fvault_get_data"zs_bank_register"g_szTempName[id], data139)
parsedata szPassword charsmaxszPassword ) , szVal charsmaxszVal ) );
 
if( 
equalg_szTempPassWord[id] , szPassword) )
{
    
iVal str_to_numszVal );
    
g_logged[id] = true;



pacheco 07-12-2012 19:49

Re: [fvault] Error in save..
 
Ok, thanks Bugsy, the password is now ok!
But and the g_AP? How to load it?
I don't understand this: iVal = str_to_num( szVal );

It's to load the g_AP[id]?

---- EDIT:
Really thanks bugsy, works correctly! Thanks so much!!!
g_AP[id] = str_to_num( szVal );

;)


All times are GMT -4. The time now is 15:18.

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