![]() |
Way to detect when a player logs off?
I have detection for when players log in but not off.
Basically I have coded my own playercount using PHP. It uses a static image and adds text to it dynamically when players log on. If no one logs on it updates every 5 minutes by requesturl. Anyway here is the image for anyone that's interested. I might release the source if people want it. Also is there a way to detect when RC players log on? http://wr3ckless.net/text/playercount.png http://wr3ckless.net/text/playercount.png |
Considering you already have the framework for the update every 5 minutes, you can just do something similar to:
NPC Code: Also possibly onPlayerLogout() |
I already have something very similar to that to check for players
it's just how to check when they log on to RC or off of RC or log off of the server. I would prefer to update it when players leave or enter rather than every 5 minutes. This way it's more accurate. Thanks for the help and I'll look into onPlayerLogout() Possibly onPlayerlogout() |
Quote:
PHP Code:
|
No reason to read the level name string, just check the level object.
PHP Code:
|
Updating every 5 minutes is a good standard in my opinion. You don't want someone logging in, logging out and sending a request every 1 second either... You should have a delay.
If you cant do it any other way, last resort would be to check the size of 'allplayers' and compare to the previous size on a loop. If its changed, obviously someone has logged out/in. |
Considering it would use about 1kb bandwidth to communicate with the PHP script, it's not a big deal if someone logs off then on.
As I said, I want it to be as accurate as possible. Thanks for all the help. |
| All times are GMT +2. The time now is 05:59 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.