[ H3LP ] Load data failure
Hello, I made a simple money save/load system with SQL by player authid, but sometimes doesn't load the player money when he join in server. I'm using the following code.
Spoiler
Spoiler
Spoiler
|
Re: [ H3LP ] SQLx load data
Don't use LIKE Unless you want Check if the string contain something use = operator
auth='%s' Im still not sure why it some times doesnt get the player ammop, btw why are you using so much delay(set_task) Use semicolon in end of each sql statement. |
Re: [ H3LP ] SQLx load data
I did some tests in phpMyAdmin and looks like doesn't matter, be with LIKE, be with = operator, with semicolon or without, but thanks anyway for the suggestion.
I will test with vault and see if the problem still is occurring. |
Re: [ H3LP ] SQLx load data
I tried with vault but players still lose ammop sometimes. Any idea?
|
Re: [ H3LP ] SQLx load data
Check if you aren't overwriting a current value with a null one somewhere along the way. It's not an sql/vault related issue if it happens with both.
|
Re: [ H3LP ] SQLx load data
I have the below observations, let me know if I am not understanding the flow correctly. You did not post your full plugin so I am making assumptions based on what you posted.
1. You attempt to retrieve the data from the db and if no rows are returned you write a row for the player. 2. Data for a player does not get updated on each disconnect since you are only inserting if the player had no data saved which will only happen on his first time on the server. You should be using INSERT only if it's the players first time on the server, from then on you should be using UPDATE. You can use REPLACE INTO if you set auth as primary key which will overwrite the same row each time. Code:
CREATE TABLE IF NOT EXISTS player (auth varchar(32) PRIMARY KEY, ammop int(11));
Spoiler
|
Re: [ H3LP ] SQLx load data
I tried with this simple code, but players still lose APs.
@Bugsy, thanks for the suggestion but my client doesn't want database anymore.
Spoiler
|
| All times are GMT -4. The time now is 12:39. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.