Raised This Month: $51 Target: $400
 12% 

[HELP] Player data randomly wipes (SQLite)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
crnova
Senior Member
Join Date: Sep 2015
Old 04-19-2016 , 15:58   [HELP] Player data randomly wipes (SQLite)
Reply With Quote #1

As the title says, player's data randomly wipes, it is unknown when, i'm using SQLite to save & load player data
Attached Files
File Type: sma Get Plugin or Get Source (Untitled.sma - 546 views - 4.2 KB)
__________________

Last edited by crnova; 04-19-2016 at 16:04.
crnova is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 04-19-2016 , 17:14   Re: [HELP] Player data randomly wipes (SQLite)
Reply With Quote #2

What you should do is set up a bunch of server_print() or log_amx() at all the locations saving data, enter as much information as possible in them. For example, which function is calling and what data it is saving. You will easily find the problem.

This seems kind of weird though. Why would you free it before saving? As far as I can see, it does not reconnect before trying to save. But maybe I misunderstood the functions. I'm not very well trained in the arts of SQL.
Code:
public plugin_end() {     if( g_SqlConnection != Empty_Handle )     {         SQL_FreeHandle(g_SqlConnection)     }         SaveAll_SQLite() }
__________________
Black Rose is offline
crnova
Senior Member
Join Date: Sep 2015
Old 04-20-2016 , 06:28   Re: [HELP] Player data randomly wipes (SQLite)
Reply With Quote #3

Quote:
Originally Posted by Black Rose View Post
What you should do is set up a bunch of server_print() or log_amx() at all the locations saving data, enter as much information as possible in them. For example, which function is calling and what data it is saving. You will easily find the problem.

This seems kind of weird though. Why would you free it before saving? As far as I can see, it does not reconnect before trying to save. But maybe I misunderstood the functions. I'm not very well trained in the arts of SQL.
Code:
public plugin_end() {     if( g_SqlConnection != Empty_Handle )     {         SQL_FreeHandle(g_SqlConnection)     }         SaveAll_SQLite() }
I'll try that, but i'm guessing the problem is,

Code:
public plugin_end() {     if( g_SqlConnection != Empty_Handle )     {         SQL_FreeHandle(g_SqlConnection)     }         SaveAll_SQLite() }

Should be

Code:
public plugin_end() {     SaveAll_SQLite()     if( g_SqlConnection != Empty_Handle )     {         SQL_FreeHandle(g_SqlConnection)     } }
__________________
crnova is offline
crnova
Senior Member
Join Date: Sep 2015
Old 04-20-2016 , 13:07   Re: [HELP] Player data randomly wipes (SQLite)
Reply With Quote #4

Okay i've solved the problem

The problem was when a map change occurs, all the players disconnect, and when they disconnect this happens:

Code:
public artifacts_disconnect(id) {     Save_SQLite(id)         g_Crates[id] = 0     g_Keys[id] = 0     g_M4A1[id] = 0     g_AK47[id] = 0     g_DEAGLE[id] = 0     g_AWP[id] = 0     g_KNIFE[id] = 0 }

As you can see above, the player's data save, and then it's set to 0, then when the Plugin ends!, all player's data is saved, Which means the "0" from above, is saved also, because on map change, plugin end occurs after disconnect.

Thank you Black Rose! putting log_amx to see the problem helped me alot
__________________
crnova is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 04-21-2016 , 13:14   Re: [HELP] Player data randomly wipes (SQLite)
Reply With Quote #5

I'm glad you found the problem. Good job!
__________________
Black Rose 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 00:13.


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