mod-playerbots icon indicating copy to clipboard operation
mod-playerbots copied to clipboard

Offline players appear as online in the char DB

Open drozco opened this issue 3 years ago • 9 comments

For some reason players continue to appear online (characters table, field online == 1) even after logging off and closing the game client. It does not matter whether they were logged in as a bot or not. This is causing a problem with display for many CMS sites that poll the database (or .acc on console) and show players currently logged in when they are not.

Logged out players should show 0 in the online field of characters table.

drozco avatar Oct 13 '22 18:10 drozco

in fact this happens, I found a temporary solution directly in the database by creating an event for this...

htc16 avatar Oct 13 '22 19:10 htc16

Please share

drozco avatar Oct 14 '22 00:10 drozco

I recommend you research on how to schedule events in MySQL with HeidiSQL. As I said, this is just an attempt to temporarily fix the problem.

htc16 avatar Oct 14 '22 01:10 htc16

Thank you very much @drozco for this and your other helpful issue reports! Details of specific issues like this are very helpful. I will investigate to fix them as soon as possible.

ZhengPeiRu21 avatar Oct 15 '22 15:10 ZhengPeiRu21

Please share

and as for this one, did you make progress in the research I indicated?

htc16 avatar Oct 17 '22 18:10 htc16

Negative. Not really looking at this right now.

drozco avatar Oct 17 '22 18:10 drozco

in about 1 or 2 hours I'll be home, I'll try to share with you how I did it, maybe you can understand.

htc16 avatar Oct 17 '22 19:10 htc16

@drozco

ALTER DEFINER=`usermysql`@`%` EVENT `eventname`
	ON SCHEDULE
		EVERY 37 MINUTE STARTS '2022-10-17 18:45:03'
	ON COMPLETION PRESERVE
	ENABLE
	COMMENT ''
	DO BEGIN
UPDATE characters SET online = 0;
END

In addition to the above, you need to activate the mysql event system, in case if this is not configured definitively at every reboot of the host you will need to activate the event system. On linux the command is this:

SET GLOBAL event_scheduler = ON;

In the case of the event above, I set it to run every 37 minutes.

htc16 avatar Oct 17 '22 21:10 htc16

Ok I see what you're doing. Thanks for that!

drozco avatar Oct 19 '22 00:10 drozco