Mysql Problems, Reseting.
Hey, i got a problem, i am using mysql on my server for saving levels, but it keeps reseting for some players and some not. When an admin changed the map, they were 4 players, 2 lost their levels, 1 kept them. 1 wasnt even playing and joined later and lost them. it isnt always like this, it is random.
Yes, yes, i have searched both google and the forum, cant find anything. Mysql have been a pain in the ass for me, ive tried client_authorized, client_putinserver, spawn, etc. nothing seems to work safely. If you have something that is safe, feel free to share your method cause im out of ideas cause ive tried most things and dont know much about mysql, and ive heard that the mysql tutorial is faulty and wrong in many cases which seems true. PHP Code:
|
Re: Mysql Problems, Reseting.
You are calling Save_PlayerLevel() at client_disconnect() which could be your problem. Show us your Save_PlayerLevel() function.
|
Re: Mysql Problems, Reseting.
Quote:
Saving hooks/functions: PHP Code:
PHP Code:
|
Re: Mysql Problems, Reseting.
Ok let me try again \o/
You should NOT touch mysql on disconnect. You are making some sort of point system where people get points by killing. So, you only need to save points on ham_killed function. Don't use disconnect because it isn't needed and isn't safe either. That's the only thing that may be causing problems here, because your load seems to be ok. |
Re: Mysql Problems, Reseting.
Quote:
but thanks for the information. i will try this. |
Re: Mysql Problems, Reseting.
Quote:
|
Re: Mysql Problems, Reseting.
Quote:
|
Re: Mysql Problems, Reseting.
If you change the map manually, it will be too fast and may not be able to save everyone's data. Plus it is not good to send so many queries at the same time. If he has the chance to save it on ham_killed, it's pointless to save it again on disconnect.
|
Re: Mysql Problems, Reseting.
client_disconnect() is useful, I just try to avoid calling functions on players there. If it's data that is stored in variables then it's fine to do the actual save procedure at disconnect.
:lol: PHP Code:
For your SQL, I would name the table something different than one of the fields. You are using a table named Level while having a field named Level. Maybe name your table 'tblLevels'? |
Re: Mysql Problems, Reseting.
I don't think so, many queries will be if you;re updating sql data after every kill
Let's assume for a 32 players full server and a 20min for ex maptime, so in this 20 mins you will have 32*nr of kills queries to run.. kind a huge ammount of jobs for the mysql server but if you're saving at the.moment when player leaves the server then the ammount of queries will be much lower since in 20mins how much players can you have that leaves or joins the server? For ex in 5 min with a round time of 2 min can be made ~100kills and this for a non csdm server(nr of kills will be much greater on this), as an oposite will you have 100 connections/ disconnections in 5min? Much likely no Also in threaded queries you don't have to free the query handle |
All times are GMT -4. The time now is 12:04. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.