Jump to content

Player table loading only on reboot


Go to solution Solved by Alina,

Recommended Posts

Hi guys,

I just found a problem. When I modify something in player table, changes aren't saved in-game, even I use /reload p. And if I reboot the server, the changes come back how it was when I disconnected from the server. I mean, I can modify in player (and save that changes) only if server is closed.

 

Can somebody give me the fix? I need real update because I'm working at maps and my character bug easiest, and I need to redefine his map_index and coords.

 

Thank you very much!

Link to comment
Share on other sites

If you absolutely must change things on player table, however, you can do so as follows:

  • Run this command ingame: /flush <your pid> - Dunno how old it is, not sure in which game revs it works.
  • Log out.
  • Change things on your db (only those that belong to the user that you've flushed)
  • Log back in, those changes will take effect immediately.

Use this sparingly, and most certainly try to avoid it on a live server unless you really really need it. There's a cache for something! :)

  • Love 3
Link to comment
Share on other sites

I don't need to make changes to player so easy. I just want to make a script, off-server (in site) to debug your character. This will set your coords and map_index to your map1 (red/blue/yellow)... It's simple.

 

For example this query for setting you to map1 blue:

UPDATE player.player 
SET `x` = '959746', `y` = '271055', `map_index` = '41', `exit_x` = '959746', `exit_y` = '271055', `exit_map_index` = '41' 
WHERE `name` = 'Example';

So, if I will do that, and I will execute query, in ~7 mins server will save that changes?

 

That's what I have in conf.txt

DB_SLEEP_MSEC           = 10
CLIENT_HEART_FPS        = 10
HASH_PLAYER_LIFE_SEC    = 600
BACKUP_LIMIT_SEC        = 3600
PLAYER_ID_START = 100
PLAYER_DELETE_LEVEL_LIMIT = 95
PLAYER_DELETE_CHECK_SIMPLE = 1
Link to comment
Share on other sites

The only way that such a script can work is if you make sure that the player is offline when you run it, and has been off for at least N minutes (where N is the flush timeout for your db player cache). If those conditions are not met, player actions will overwrite the values you set on DB.

 

As you've been told, you can reduce the flush time but that's not advisable, the cache is there to reduce the load of constant DB read/updates and the extra processing that also takes on the game's database executable.

Link to comment
Share on other sites

You don't understand me. That script will work when your server wrong coordonates (if that happens, it's logic that player will be kicked out), and that script just reset his coordonates. After this, how much time will be forced to stay logged off? I mean, where I can see that flush time? I just wanna know, after that flush cache, will that query be saved? I'm sorry if you didn't understand... I really don't know how to explain...

Link to comment
Share on other sites

"The simplest explanation is probably the right explanation."

- Occam's razor

 

You can just use a source-based solution. If you run into that error, you can reset the players coordinates or something. That should do the trick without the need to flush caches etc...  ;)

 

That's what I try to know.. Witch trick I've to use? And can make that trick to be automatically when that player reset his coordinates?

Link to comment
Share on other sites

Can you post the error you're getting when the player is at an invalid coordinate?

I could provide a small solution, it's not that big. When the error occurs, you can just Set the player coordinates to a specific place and map index.

 

Also. You're working on a map, don't you? Why not exten the server_attr so you won't get kicked off? You can extend it, walk around and do your job and then revert to the old server_attr after you're done ;)

Link to comment
Share on other sites

  • Solution

Weeeeeeeeeeeeeeeeeell, the best way to do this is using the plain functions.

You'd know how the cache works. The gamefile holds the player values in memory, so it allocates RAM for every player. Also it sends the data stored to the dbcache and there's the cache you're looking for. You can manually push the values to the dbcache by calling SaveReal() from the CHARACTER-class (the normal Save() has a delay)

But there's no need to edit the cache itself! You only have to edit the values stored in the gamefile. The next update will push it to the dbcache where it's cached and then written to the database later. So. Yeah, you found it :D

What you might be looking for is Show(long lMapIndex, long x, long y, long z = LONG_MAX, bool bShowSpawnMotion = false) or Goto(long x, long y) in CHARACTER-class.

 

These functions will overwrite the position stored inside the game instance. The next Save cycle will push it to the dbcache. If you're getting the error and relocating your character, you can straight log in again and it will work, no need to terminate the server or reload anything ;)

  • Love 1
Link to comment
Share on other sites

 

 

PLAYER_CACHE_FLUSH_SECONDS = 0

Well. No. It does nearly to nothing to be honest :)

 

Main.cpp stores the Config entry into the variable g_iPlayerCacheFlushSeconds.

This variable is only called one more time then (the other two calls are commented). And the snippet looks like this:

m_expireTime = MIN(1800, g_iPlayerCacheFlushSeconds);

Therefore, the min time for caching is 1800 no matter what you type in :)

 

Also, for trying that, I hereby declare you guilty of trying to break your own server! Now go to a dark corner and cry full of shame! Well.. Maybe that's exaggerated a bit. But you still shouldn't do something like this. Never. Ever. :)

Link to comment
Share on other sites

 
m_expireTime = MIN(1800, g_iPlayerCacheFlushSeconds);

Therefore, the min time for caching is 1800 no matter what you type in :)

Read that again Alina! :P

 

MIN(1800, 0) is most certainly 0.

Max time for caching is 1800, though.

 

But but but

Also, for trying that, I hereby declare you guilty of trying to break your own server! No go to a dark corner and cry full of shame! Well.. Maybe that's exaggerated a bit. But you still shouldn't do something like this. Never. Ever. :)

+1 haha

  • Love 1
Link to comment
Share on other sites

 

 

m_expireTime = MIN(1800, g_iPlayerCacheFlushSeconds);

Therefore, the min time for caching is 1800 no matter what you type in :)

Read that again Alina! :P

 

MIN(1800, 0) is most certainly 0.

Max time for caching is 1800, though.

 

But but but

 

 

Also, for trying that, I hereby declare you guilty of trying to break your own server! No go to a dark corner and cry full of shame! Well.. Maybe that's exaggerated a bit. But you still shouldn't do something like this. Never. Ever. :)

+1 haha

 

 

Sorry, I missed something there. Thought that MIN would work like MINMAX, but that'd require for YMIR to write meaningful code... :D

Actually MINMAX does define a minimum and maximum value, I thought with MIN it was the same but I miserably failed. Thanks for correcting me :)

It also doesn't make sense for them to limit the max cache duration but not the minimum one. They're strange. Really. :/

 

Still. Setting to 1 or 0 is plain suicide. Good luck with that :D

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.