[RELEASE] Script - Number of Players Online

02/07/2010 20:34 ProfNerwosol#1
Updated

Script showing how many players are online, with distinction by race.

Instructions:

Note that for it to work, you need to alter two procedures in PS_GameData and add one colum in PS_GameData.dbo.Chars, LoginStatus. Files with sql code are included.

What it does?

Everytime players logs in LoginStatus is changed to 1. PHP script when run, read everyone with LoginStatus=1, counts and prints on screen. Then 'extracts' from those online how many are ... human, elf, vail, nordein.

Procedures to midify:
Code:
usp_Read_Chars_Detail2_R
usp_Save_Char_LeaveDate_R
Credit for modified procedures goes to an unknown person. I got them from a friend.
02/09/2010 17:00 Polypropylen#2
added to the important topics
03/07/2010 06:35 thunderxc#3
I tried. All I am getting is a blank page. Hmm...
05/03/2010 19:24 Shaiya Xtreme#4
How to add it in the 1.php script ?
05/12/2010 20:18 ProfNerwosol#5
Include the file.

I updated the php script. It should be working better now.
06/09/2010 15:43 lae#6
Thank you for the scripts. I was using a similar one, but yours is clearer.

Although with some characters the usp_Save_Char_LeaveDate_R doesn't change the Loginstatus to 0. The leave date is changing, but the login status is not.

Did any of you get similar failure?

I have tried on my computer (on my test pserver) and the script was fine, but when we put it to our real pserver it is not working with some characters.
I didn't find any connection between that characters. I have checked the code several times and I have no idea now what could be the problem.
06/10/2010 23:44 pinoygoku#7
does this scritp work for server ep5? becuas ei treid it no wokr
06/14/2010 01:22 ProfNerwosol#8
The script should work with any server. It's not dependant on the version but on whether you added LoginStatus field in PS_GameData.dbo.Chars and updated two procedures to change the value once player logs in.

PS.

This script is simple. You can observe what a bit more advanced version does on kingdoms website (once its back and running).

[Only registered and activated users can see links. Click Here To Register...]
06/19/2010 23:59 lae#9
Thank you.
07/07/2010 14:50 AriezOMG#10
mind helping me out with this a bit? when i look on the page, what i see is:

Code:
Players online: ".$online." Human: ".$human." Elf: ".$elf." Vail: ".$vail." DeathEater: ".$nordein." "; @mssql_close($link); ?>
did i do something wrong?
07/09/2010 12:53 ProfNerwosol#11
You need to install PHP for your web server.
07/11/2010 12:36 AriezOMG#12
I do have it installed, but for some reason i still get this
Code:
Players online: ".$online." Human: ".$human." Elf: ".$elf." Vail: ".$vail." DeathEater: ".$nordein." "; @mssql_close($link); ?>
07/11/2010 22:44 NocturnalSniper#13
Quote:
Originally Posted by Apocalypsist View Post
I do have it installed, but for some reason i still get this
Code:
Players online: ".$online." Human: ".$human." Elf: ".$elf." Vail: ".$vail." DeathEater: ".$nordein." "; @mssql_close($link); ?>
I am getting the exact same problem with this script.
All SQL executed without error and Server Is running PHP with MSSql extension on the server allowed.
the registration page works fine but this one just shows what Apocalypsist shows.
07/11/2010 23:39 AriezOMG#14
Grr, I really want this to work because it'll come in handy majorly >.<
07/13/2010 14:32 il.mane#15
Apocalypsist the script need to be in the root directory of your web server...

i got a different problem..
the script wont read the colum LoginStatus
i been try to add the if and else to debug it

Code:
if (!$result  = @mssql_query("SELECT LoginStatus, Family FROM Chars WHERE LoginStatus=1",$link))
		{
            print "Failed to select colum.";
        };
and it return me "Failed to select colum."
the querys work fine in SQL and i can see who's online and who's not

i also try with another tinyint value colum in the same table and it work like a charm
wonder if theres something i miss in SQL