SQL Money saving optimization help
Okay, so here's the deal: I got a server running which uses "credits" as currency instead of money. You get one credit for each minute you play, but that's pretty irrelevant. What I care about is saving those credits, and I use SQL for that, but since I barely know how to use it, it proved to be a challenge. People are sometimes losing their credits, there's no real evidence of how and why but they do, and it's not just some dumbasses lying to get some free cash. There's almost no latency between the sql host and the server(same machine) and by what I figured out it has something to do with the credits getting saved after they are set to 0. Please help me figure it out.
Since the plugin is not public and many would do lots of things to get it, I can't post the full source(also it's huge, 5k lines), but I will post everything relevant to the cause. Code:
Okay so the SQL connection and all that stuff is taken from a SQL tutorial off this forum and it's working fine, won't post that.Thanks for reading. |
Re: SQL Money saving optimization help
instead of using tasks, create the save_mysql function with 2 parameters and pass players credits as the second parameter, that way you can set the 0 in the array instantly
Code:
public client_disconnect(id) |
Re: SQL Money saving optimization help
Quote:
I had to remove the saving on disconnect due to many users losing money after disconnecting. Right now my server is exploitable due to this because once an user gets one credit and his balance is saved he can keep dropping credits on the ground until the next minute and if he disconnects he duplicates the money |
Re: SQL Money saving optimization help
bumping this, anyone have a solution please?
|
Re: SQL Money saving optimization help
You have some glitches in your code, 'register_client' should stop at that failstates and there are so many tasks. Start making some debugs, is data saved or loaded properly? From what i see most probably your sql code part must be rewritten.
|
Re: SQL Money saving optimization help
Quote:
Code:
Save_MySql(id)I thought SQL is way too efficient for something like this to happen. If it's the case I'll remove the setnull task and just save them and leave the credits on that id, and only reset them when someone connects on it, because that doesn't seem to cause a problem If anyone here is a sql guru I'd like a confirmation on whether such kind of delay is possible with sql(2~3 seconds) |
| All times are GMT -4. The time now is 19:09. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.