AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [HELP] Player data randomly wipes (SQLite) (https://forums.alliedmods.net/showthread.php?t=281752)

crnova 04-19-2016 15:58

[HELP] Player data randomly wipes (SQLite)
 
1 Attachment(s)
As the title says, player's data randomly wipes, it is unknown when, i'm using SQLite to save & load player data

Black Rose 04-19-2016 17:14

Re: [HELP] Player data randomly wipes (SQLite)
 
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() }

crnova 04-20-2016 06:28

Re: [HELP] Player data randomly wipes (SQLite)
 
Quote:

Originally Posted by Black Rose (Post 2412457)
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 04-20-2016 13:07

Re: [HELP] Player data randomly wipes (SQLite)
 
Okay i've solved the problem :D

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

Black Rose 04-21-2016 13:14

Re: [HELP] Player data randomly wipes (SQLite)
 
I'm glad you found the problem. Good job!


All times are GMT -4. The time now is 09:07.

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