Raised This Month: $ Target: $400
 0% 

SQLX reset user data


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
loiraolhosazul
Member
Join Date: May 2020
Old 01-08-2021 , 18:05   SQLX reset user data
Reply With Quote #1

Example: the guy enters the server, but the sql did not connect, and by chance the sql connects in the middle of the match, when this player leaves the server their data is 0, because when he entered the sql did not load their data, any tips?
loiraolhosazul is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-08-2021 , 18:52   Re: SQLX reset user data
Reply With Quote #2

The first thing you can try is to remove any delay during the connection step. So if you're doing the connection with set_task, do it in either plugin_init or plugin_cfg directly. As far I know, both are called before any player joins the server.

If that doesn't apply to you, you could set an "infinite" task when a player joins the server and keep trying to load the data. Once successfully loaded, remove the task. You would probably need to check if the task doesn't exists before inserting/updating.

Yet another way is to create a bool and set it to true if the data is loaded. Then, in the "save data function", check whether the variable is true or false. If true, insert/update, if false you do nothing.

Consider posting the code of the plugin. If we knew the cause, you would probably receive a more specific answer.
__________________









Last edited by CrazY.; 01-08-2021 at 18:59.
CrazY. is offline
loiraolhosazul
Member
Join Date: May 2020
Old 01-08-2021 , 19:01   Re: SQLX reset user data
Reply With Quote #3

maybe I use sqlite, then the problems are over, but I can't use web pages
loiraolhosazul 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 14:07.


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