Mysql save wrong variables - mixing pSpawn and pSkin
#21

Quote:
Originally Posted by Gammix
Посмотреть сообщение
Nope, thats not recommended. I think he meant to say that variables which don't change frequently should be directly saved or loaded to/from the database and should not have any global variable for itself.
Exactly, stuff like donor or admin level don't update frequently or stuff such as Kills, Deaths which update too frequently (unless a RP GM) should be only done when needed. I also distribute my admin and donor levels to different tables to avoid unnecessary pain when reading the database and saves some space :P
Reply
#22

Quote:
Originally Posted by coool
Посмотреть сообщение
Bad idea of cash as Gammix had already stated that calling queries for frequent changes such as kills, deaths, cash, score etc is bad. Now you can easily see if it is good to have a whole query for frequent things Or calling queries for every change.
How is it bad? Queries are fast enough, but if you are still worried about the lag that probably won't happen then use MySQL with threaded queries.
Reply
#23

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
How is it bad? Queries are fast enough, but if you are still worried about the lag that probably won't happen then use MySQL with threaded queries.
I think we are talking about efficiency here so yes variables are way faster than queries.

And whoever saying that saving all data at once can cause problem *sometimes* is competently wrong. Like this method has been followed since ages and there were no problems ever since.
Reply
#24

Quote:
Originally Posted by Tord
Посмотреть сообщение
Said with easier words; when you change something as it updates - lets say someone gives a player $1000 - Instead of just saving this into his variables, you update the database straight away.

If you update the database frequently, whenever (mostly) when something changes, you avoid the server being overloaded by saving EVERYTHING once in a while. It's way more demanding and issues may occur. This is also referred to as Load Balancing. Wikipedia page here.

So - it's highly recommended
That's what I'm doing plus I save all stats one or two times. Not at every changes ^^'
Reply
#25

Quote:
Originally Posted by Gammix
Посмотреть сообщение
I think we are talking about efficiency here so yes variables are way faster than queries.

And whoever saying that saving all data at once can cause problem *sometimes* is competently wrong. Like this method has been followed since ages and there were no problems ever since.
Was mostly a problem before the threaded queries were implemented into the MySQL plugin by BlueG. So yes, it caused problems, as I have experienced 2-4 second lag each time everyone's stats were saved.

So I am not completely wrong, I just didn't make myself clear what I meant.
Also, Load Balancing is a thing for a reason - 500 players, with lets say 40 updated values on each player - it's not gonna go buttersmooth every time
Reply
#26

Okay so player data (variables) that are changing more times than others I save on player disconnect. Others variables i save when they change (giving admin, vip, ...)

Also what about this:
Quote:
Originally Posted by Saddin
Посмотреть сообщение
Thanks, this is okay now.

Just to ask one more question so I don't have to open another topic.
Why is when I send string like this:

PHP код:
mysql_tquery(Databasequery"IfPlayerNameExists""si"targetnameiOrgID); 
On the other side I get correct iOrgID, but targetname is weird symbol: ь
Reply
#27

may we see the function itself?

In order to pass strings, the params in the function has to accept strings.

PHP код:
public IfPlayerNameExists(name[], Org
{...} 
It could look like there's some mismatching params from what I can tell, but not entirely sure. Be sure to check that up
Reply
#28

Quote:
Originally Posted by Tord
Посмотреть сообщение
may we see the function itself?

In order to pass strings, the params in the function has to accept strings.

PHP код:
public IfPlayerNameExists(name[], Org
{...} 
It could look like there's some mismatching params from what I can tell, but not entirely sure. Be sure to check that up
Thanks, I forgot to put "[]" after string "targetname" so now it works fine
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)