|
You last visited: Today at 10:38
Advertisement
[RELEASE] Script - Number of Players Online
Discussion on [RELEASE] Script - Number of Players Online within the Shaiya PServer Guides & Releases forum part of the Shaiya Private Server category.
12/28/2011, 21:55
|
#31
|
elite*gold: 0
Join Date: Oct 2009
Posts: 69
Received Thanks: 152
|
Something more
Admin can see much faster and easier certain things like
list of online players ,Levels, IP addresses if use script:
PHP Code:
<?PHP
$dbhost=localhost
$dbuser=Shaiya
$dbpass=Shaiya123
// connect to SQL server
$link = mssql_connect("$dbhost","$dbuser","$dbpass")
or die ("Failed to connect to MSSQL server.");
// check who's online
$result = mssql_query("SELECT c.Family,c.CharName,c.Level,u.UserIP
FROM [PS_GameData].[dbo].[Chars] c INNER JOIN
[PS_UserData].[dbo].[Users_Master] u ON
c.UserUID=u.UserUID WHERE c.LoginStatus=1
ORDER BY u.UserIP ",$link);
// initialize veriables
$online = mssql_num_rows($result);
$human = 0;
$elf = 0;
$vail = 0;
$nordein = 0;
if ($online==0) echo "empty server :)";
else
{
// fill variables with data (who's online)
echo "<table cellspacing=1 cellpadding=2 color=\"red\" bordercolor=#FF9933
border=1 style=background-color:#999966 style=\"border-style:hidden;\">";
while($row = mssql_fetch_array($result))
{
switch($row[0])
{
case 0: $human++;$color="green";break;
case 1: $elf++;$color="green";break;
case 2: $vail++;$color="red";break;
case 3: $nordein++;$color="red";break;
};
// Print CharName,Level,CharIP of each online player
echo "<tr><td><font color=\"$color\">".$row[1]."</font></td><td>
".$row[2]."</td><td> ".$row[3]."</td></tr>";
}
echo "</table></br>";
// Print number of online players
echo "<table cellspacing=1 cellpadding=2 color=\"red\" bordercolor=#FF9933
border=1 style=background-color:#999966 style=\"border-style:hidden;\">
<tr><td>Players online: </td><td>".$online."</td></tr>
<tr><td>Human: </td><td>".$human."</td></tr>
<tr><td>Elf: </td><td>".$elf."</td></tr>
<tr><td>Vail: </td><td>".$vail."</td></tr>
<tr><td>DeathEater: </td><td>".$nordein."</td></tr>
</table>";
}
mssql_close($link);
?>
|
|
|
12/28/2011, 22:08
|
#32
|
elite*gold: 46
Join Date: Nov 2009
Posts: 1,400
Received Thanks: 4,249
|
php script for showing IP adresses? 
for what is it good for when admins can see all this stuff in the db itself?
|
|
|
12/29/2011, 07:12
|
#33
|
elite*gold: 150
Join Date: Apr 2010
Posts: 9,739
Received Thanks: 8,981
|
Certainly for an admin control panel; this is something that is actually going to help me on some little things I am working on right now.
|
|
|
12/29/2011, 09:21
|
#34
|
elite*gold: 0
Join Date: Oct 2009
Posts: 69
Received Thanks: 152
|
Yes, this little script can be developed further by adding a dropdown menu by adding dates of creation of characters, etc. In this variant, the program displays the players playing in multiple windows(same IP addresses), and they are 90% of potential cheaters. To correct readings are always "online" should be approached very carefully to everything written in previous posts colleagues.
|
|
|
02/23/2012, 00:46
|
#35
|
elite*gold: 0
Join Date: Nov 2011
Posts: 42
Received Thanks: 3
|
Ok firstly really sorry to necro
But i am having a small issue, the script is working on website (thx) but for some reason my loginstatus is not changing from 0 thus showing as noone online
Any fix for this I ran both procs and obviously the add loginstatusit just doesnt seem to work for me
|
|
|
03/04/2012, 16:51
|
#36
|
elite*gold: 0
Join Date: Oct 2009
Posts: 69
Received Thanks: 152
|
It's so simple solution.
There is a very simple solution, when a player goes to character selection screen instead of closing the game window. Add to PS_GameLog usp_Insert_Action_Log_E following lines:
IF (@ActionType = 108)
BEGIN
UPDATE PS_GameData.dbo.Chars SET LeaveDate=GETDATE(), LoginStatus=0 WHERE CharID=@CharID
END
|
|
|
03/19/2012, 00:01
|
#37
|
elite*gold: 0
Join Date: Mar 2012
Posts: 27
Received Thanks: 7
|
Invalid column name 'LoginStatus'.
|
|
|
03/19/2012, 03:39
|
#38
|
elite*gold: 0
Join Date: Sep 2010
Posts: 520
Received Thanks: 1,289
|
Quote:
Originally Posted by ProfNerwosol
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.
|
Quote:
Originally Posted by [Dev]#Closed#
Invalid column name 'LoginStatus'.
|
Do people read anymore? Or do they expect everything to be handed to them?
|
|
|
03/19/2012, 04:02
|
#39
|
elite*gold: 0
Join Date: Mar 2012
Posts: 27
Received Thanks: 7
|
ty^^
now Column names in each table must be unique. Column name 'LoginStatus' in table 'dbo.Chars' is specified more than once.
|
|
|
03/19/2012, 09:30
|
#40
|
elite*gold: 0
Join Date: Sep 2010
Posts: 520
Received Thanks: 1,289
|
PHP Code:
USE PS_GameData
IF NOT EXISTS(SELECT * FROM sys.columns WHERE Name = 'LoginStatus' AND object_id = OBJECT_ID('Chars'))
BEGIN
ALTER TABLE Chars
ADD LoginStatus bit
PRINT 'Column successfully added!'
END
ELSE
BEGIN
PRINT 'Column already exists!'
END
|
|
|
12/23/2012, 23:03
|
#41
|
elite*gold: 0
Join Date: Feb 2010
Posts: 98
Received Thanks: 100
|
one? if I mark all and puts me in total = -1 or want to know why is so and not put the total of those who are online
|
|
|
05/30/2013, 14:49
|
#42
|
elite*gold: 0
Join Date: Feb 2013
Posts: 41
Received Thanks: 9
|
Sorry if I'm upping an old topic, but I have convert mssql of the author to odbc because mssql dont work on latest php releases. It's for you devs
Quote:
<?php
// replace with your own settings
$dbhost = '127.0.0.1';
$dbuser = 'Shaiya';
$dbpwd = 'shaiya123';
$conn = @odbc_connect("Driver={SQL Server};Server=$Host", $User, $Password);
// check who's online class by class
$result = @odbc_exec($conn,"SELECT LoginStatus, Family FROM PS_GameData.dbo.Chars WHERE LoginStatus=1");
$result1 = @odbc_exec($conn,"SELECT LoginStatus, Family FROM PS_GameData.dbo.Chars WHERE LoginStatus=1 AND Family=0");
$result2 = @odbc_exec($conn,"SELECT LoginStatus, Family FROM PS_GameData.dbo.Chars WHERE LoginStatus=1 AND Family=1");
$result3 = @odbc_exec($conn,"SELECT LoginStatus, Family FROM PS_GameData.dbo.Chars WHERE LoginStatus=1 AND Family=2");
$result4 = @odbc_exec($conn,"SELECT LoginStatus, Family FROM PS_GameData.dbo.Chars WHERE LoginStatus=1 AND Family=3");
// initialize veriables
$online = @odbc_num_rows($result);
$human = @odbc_num_rows($result1);
$elf = @odbc_num_rows($result2);
$vail = @odbc_num_rows($result3);
$nordein = @odbc_num_rows($result4);
// Print number of online players
print "<table style=\"border: 1px solid black;\">
<tr><td colspan=2>Players online: </td><td>".$online."</td></tr>
<tr><td>Human: </td><td>".$human."</td></tr>
<tr><td>Elf: </td><td>".$elf."</td></tr>
<tr><td>Vail: </td><td>".$vail."</td></tr>
<tr><td>DeathEater: </td><td>".$nordein."</td></tr>
</table>";
@odbc_close($conn);
?>
|
|
|
|
06/02/2013, 18:54
|
#43
|
elite*gold: 0
Join Date: Jul 2010
Posts: 523
Received Thanks: 523
|
Correct me if I'm wrong:
When a player quits the game using ALT + F4, LoginStatus won't get updated and will remain '=1' and that will give you a false amount of "online players"
May be you could use the 'Leave' field (in PS_Userdata.dbo.Users_master) to check online status. (there's a post from Castor with more details about this field)
|
|
|
06/02/2013, 20:08
|
#44
|
elite*gold: 0
Join Date: Dec 2010
Posts: 717
Received Thanks: 3,366
|
You are right.
The 'LoginStatus' field simply does not exist in regular Chars table.
So there is obviously no way to have such script working unless one fullfill tons of prerequesites no listed there, nor in the full thread.
From a strict SQL point of view, performing 5 identical requests selecting fields that are never used is very awkward.
The information shall be obtained (assuming the required & not documented changes) by:
Code:
SELECT Family,count(*) FROM PS_GameData.dbo.Chars WHERE LoginStatus=1 GROUP BY Family
thinking that ODBC is smart is an error (and btw it is NEVER mandatory to use it, native drivers always work), thinking that transfering kilos or megabytes of useless recordsets has no cost is also an error.
|
|
|
06/03/2013, 10:49
|
#45
|
elite*gold: 0
Join Date: Feb 2013
Posts: 41
Received Thanks: 9
|
If you can read all posts of this topic, you can find a fix for the loginstatus bug when player disconnected with atl+f4. It is a sql update which creates a trigger which uses the error UserLog.
If someone gets disconnected the server sends error values in this log,
this Trigger sets the User LoginStatus that got DCed back to 0 if a new error row gets added. (  )
So my php script work perfectly.
ps: sorry for my english
|
|
|
 |
|
Similar Threads
|
[Release]Users Visiting/Players Online
03/28/2012 - EO PServer Guides & Releases - 5 Replies
Just some simple code to display how many people are visiting your site and the number of players on your server.
Players Online:
This one will not display your players online unless you are running a website on the same computer as the server.
I am working on making a code that can grab the users online from a website that isn't hosted on the servers computer.
<?php echo (exec('netstat -a -n |find "5816" |find "ESTABLISHED" /c')-2); ?>
Users Visiting:
<?php
$output = shell_exec...
|
[HELP]SCRIPT PHP PLAYERS ONLINE
04/12/2011 - Dekaron Private Server - 12 Replies
Not know much about PHP I'M WITH A DOUBT AS AGENT IN AN ONLINE PLAYERS SYNTAX WHAT IT IN TIME FOR YOU TO READ THE DATABASE NOT READ NAMES OF FILES CONTAINING ", ...
BELOW IS THE FILE:
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Geneva, sans-serif;
color: #FFFF00;
font-weight: bold;
}
body {
|
[Release] Total Players Online
09/09/2009 - CO2 PServer Guides & Releases - 1 Replies
For Who Looking For that code
that code let you know how many players
play on your server now Its Not Made by Me
Total Players Online: 30
Just Put it On Register.php
|
[RELEASE] Free Items to all Online Players
07/30/2009 - CO2 PServer Guides & Releases - 17 Replies
A "free" Command, put this Command in Client.cs under GM or Owner Command and change "@" to "/" if your command start with "/" "LOFT code not CoEmu v2"
if (Splitter == "@free")
{
if (Splitter == "db")
{
foreach (DictionaryEntry DE in World.AllChars)
{
...
|
[REQUEST] online players script
10/30/2008 - EO PServer Hosting - 18 Replies
hi all ,
i think that the titel says enouf of what i want to aks , but to be shure i goin write a little more ^^
i aim looking for a script whit a few things
server offline
server online
players online
|
All times are GMT +1. The time now is 10:38.
|
|