Dimmi 19 Posted April 3, 2015 Share Posted April 3, 2015 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 More sharing options...
Premium .Avenue™ 782 Posted April 4, 2015 Premium Share Posted April 4, 2015 I thank that's 'cause the player-table loads the data from the cache of the running server Link to comment Share on other sites More sharing options...
Premium Shogun 4588 Posted April 4, 2015 Premium Share Posted April 4, 2015 There is no "fix" the table is cached. Link to comment Share on other sites More sharing options...
Premium Galet 510 Posted April 4, 2015 Premium Share Posted April 4, 2015 Btw, Is there's a way to reduce the cache of the player table ? I've already tried but it won't work. Link to comment Share on other sites More sharing options...
Alina 234 Posted April 4, 2015 Share Posted April 4, 2015 You shouldn't mess up with the cache. That's no good ideat :/ 1 Link to comment Share on other sites More sharing options...
Denis 1474 Posted April 4, 2015 Share Posted April 4, 2015 The current time for player cache is 7 minutes(420 seconds), but you can change it by writing PLAYER_CACHE_FLUSH_SECONDS = seconds at your conf.txt at db folder. But like Alina said you shouldn't mess up with the cache. 1 Link to comment Share on other sites More sharing options...
Think 117 Posted April 4, 2015 Share Posted April 4, 2015 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! 3 Link to comment Share on other sites More sharing options...
Dimmi 19 Posted April 4, 2015 Author Share Posted April 4, 2015 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 More sharing options...
Think 117 Posted April 4, 2015 Share Posted April 4, 2015 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 More sharing options...
Dimmi 19 Posted April 4, 2015 Author Share Posted April 4, 2015 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 More sharing options...
Alina 234 Posted April 4, 2015 Share Posted April 4, 2015 "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... Link to comment Share on other sites More sharing options...
Dimmi 19 Posted April 4, 2015 Author Share Posted April 4, 2015 "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 More sharing options...
Alina 234 Posted April 4, 2015 Share Posted April 4, 2015 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 More sharing options...
Dimmi 19 Posted April 4, 2015 Author Share Posted April 4, 2015 The error with invalid map I solved by replacing all outdoors and indoors file with outdoors & indoors from a client for 34k... But now I just want to know how to "play" with this cache and player table... Maybe, some day, I will need it.. Link to comment Share on other sites More sharing options...
Solution Alina 234 Posted April 4, 2015 Solution Share Posted April 4, 2015 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 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 1 Link to comment Share on other sites More sharing options...
Dimmi 19 Posted April 4, 2015 Author Share Posted April 4, 2015 Oooh, finally got it! Thank you! Link to comment Share on other sites More sharing options...
YukiPowa 5 Posted April 4, 2015 Share Posted April 4, 2015 PLAYER_CACHE_FLUSH_SECONDS = 0 With : http://www.ovh.com/fr/serveurs_dedies/enterprise/2014-SP-64.xml Good or not good ? Link to comment Share on other sites More sharing options...
Alina 234 Posted April 4, 2015 Share Posted April 4, 2015 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 More sharing options...
Dimmi 19 Posted April 4, 2015 Author Share Posted April 4, 2015 I forgot to say, it's a problem if I don't have PLAYER_CACHE_FLUSH_SECONDS in conf.txt? Link to comment Share on other sites More sharing options...
Denis 1474 Posted April 4, 2015 Share Posted April 4, 2015 No, by default g_iPlayerCacheFlushSeconds is setted to 7 minutes at Main.cpp 1 Link to comment Share on other sites More sharing options...
YukiPowa 5 Posted April 5, 2015 Share Posted April 5, 2015 I change default in main.cpp to 0 or 1 seconds I test after Link to comment Share on other sites More sharing options...
Think 117 Posted April 5, 2015 Share Posted April 5, 2015 m_expireTime = MIN(1800, g_iPlayerCacheFlushSeconds); Therefore, the min time for caching is 1800 no matter what you type in Read that again Alina! 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 1 Link to comment Share on other sites More sharing options...
Alina 234 Posted April 5, 2015 Share Posted April 5, 2015 m_expireTime = MIN(1800, g_iPlayerCacheFlushSeconds); Therefore, the min time for caching is 1800 no matter what you type in Read that again Alina! 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... 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now