Raised This Month: $ Target: $400
 0% 

Mysql Problems, Reseting.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 05-11-2015 , 17:46   Re: Mysql Problems, Reseting.
Reply With Quote #1

Quote:
Originally Posted by Jhob94 View Post
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.
Why would that be? Besides saving every time data is touched, saving on disconnect is pretty much the only way to reliably save data for clients. Everything else is just additional safety nets.
__________________
In Flames we trust!
Nextra is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-11-2015 , 18:44   Re: Mysql Problems, Reseting.
Reply With Quote #2

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. In your case, I would store each players steam id in a global array of strings (retrieve at client_authorized), this will save you a native call @ disconnect as well. I just noticed that you are already retrieving authid into a global array at authorized and you even have a comment saying it will be used at disconnect for safe saving. I'm guessing you copied the code from somewhere?


PHP Code:
public client_authorized(Id

    
get_user_authid(Idg_Steam[Id], charsmax(g_Steam[])) // Lets get SteamID just once. Safe for client_disconnect saving  

//...

public Save_PlayerLevel(id)
{
    static 
szAuthId[33];
    
get_user_authid(idszAuthId32); 
I would get an application that can view your tables to make sure all of the data looks ok.

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'?
__________________

Last edited by Bugsy; 05-11-2015 at 18:44.
Bugsy is offline
SkumTomteN
Veteran Member
Join Date: Oct 2013
Location: Asgard
Old 05-11-2015 , 20:47   Re: Mysql Problems, Reseting.
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
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. In your case, I would store each players steam id in a global array of strings (retrieve at client_authorized), this will save you a native call @ disconnect as well. I just noticed that you are already retrieving authid into a global array at authorized and you even have a comment saying it will be used at disconnect for safe saving. I'm guessing you copied the code from somewhere?


PHP Code:
public client_authorized(Id

    
get_user_authid(Idg_Steam[Id], charsmax(g_Steam[])) // Lets get SteamID just once. Safe for client_disconnect saving  

//...

public Save_PlayerLevel(id)
{
    static 
szAuthId[33];
    
get_user_authid(idszAuthId32); 
I would get an application that can view your tables to make sure all of the data looks ok.

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'?
Yeah, its jhobs code for disconnect i found on the mysql tutorial topic.

someone should really make a more detailed mysql tutorial with do's and dont's etc.

I will name the table something else, and i do not know any application since do not really know specifically what u mean by that.

Quote:
Originally Posted by Jhob94 View Post
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.
You are correct to 100%, some were not saved, others were.

Quote:
Originally Posted by Clauu View Post
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
That would be true, but not in this case, since im running a zombie server. most people will get infected.
so only zombies recieving a headshot can really die. but thats also a problem now.. what if a player doesnt recieve a headshot when zombie?, his data(level) wont be saved.
you also didnt see what jhob wrote.

So we gotta save when he gets infected and killed.. thats my best guess.
__________________
Contact: Steam
Videos: Youtube

Last edited by SkumTomteN; 05-11-2015 at 21:22.
SkumTomteN is offline
Clauu
Senior Member
Join Date: Feb 2008
Location: RO
Old 05-12-2015 , 00:40   Re: Mysql Problems, Reseting.
Reply With Quote #4

Quote:
Originally Posted by SkumTomteN View Post
what if a player doesnt recieve a headshot when zombie?, his data(level) wont be saved.
Store data in individual player array and flush it to mysql server at disconnect and it will be saved, it;s simple
Clauu 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 18:43.


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