Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Shaiya > Shaiya Private Server > Shaiya PServer Development
You last visited: Today at 18:01

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Searching for an Online counter

Discussion on Searching for an Online counter within the Shaiya PServer Development forum part of the Shaiya Private Server category.

Reply
 
Old   #1
 
SeriouS_'s Avatar
 
elite*gold: 0
Join Date: Jan 2014
Posts: 239
Received Thanks: 20
Smile Searching for an Online counter

Hey all im searching for an Online counter for Game Server / Log in as SQL or php.
Would be great if you Pm me i you know/Have a script

Greetz SeriouS_
SeriouS_ is offline  
Old 11/17/2014, 19:35   #2
 
wallerus's Avatar
 
elite*gold: 0
Join Date: Apr 2014
Posts: 300
Received Thanks: 473
Step 1. Use this in your SQL to create a new column on chars.

Code:
ALTER TABLE [PS_GameData].[dbo].[Chars]
ADD LoginStatus TINYINT DEFAULT '0' NOT NULL
Step 2. Next, go to PS_GameData Stored Procedures >

In usp_Read_Chars_Detail2_R, change:
Code:
UPDATE Chars SET JoinDate=GETDATE(), LoginStatus = 1 WHERE CharID=@CharID
Step 2.5.
usp_Save_Char_LeaveDate_R, change:
Code:
UPDATE Chars SET LeaveDate=GETDATE(), LoginStatus = 0 WHERE CharID=@CharID
Now you just want to run one of the following, or both queries depending on what you want, the first will show how many are on and the second will show who.
Total Players:
Code:
SELECT COUNT(LoginStatus) AS PlayersOnline
FROM [PS_GameData].[dbo].[Chars]
WHERE LoginStatus = 1	-- Filters online people only.
See who's online (+ more in-depth info, all you need to do is add the columns)
Code:
SELECT
UserID,CharName,Level,Map,K1 AS Kills,K2 AS Deaths
FROM [PS_GameData].[dbo].[Chars]
WHERE LoginStatus='1'	-- Filters online people only.
ORDER BY
Map		-- Choose a column to sort by, i.e. Map.
DESC		-- ASC (ascending) or DESC (descending)


Here's the PhP script for it.
Code:
<?php
    $sql_server = "127.0.0.1";
    $sql_user = "sa";
    $sql_pass = "123456";
    $sql_data = "PS_GameData";
	$conn=mssql_connect($sql_server,$sql_user,$sql_pass);
	$xadb = mssql_select_db($sql_data,$conn) or die("$uwebmsg_cerr");

	$toplvlq = "SELECT * FROM CHARS WHERE (LoginStatus = 1) ORDER BY Level DESC";
	$toplvlr = mssql_query($toplvlq);
	$toplvl_num = 0;
	echo "<p><b>TOP PLAYERS<b></p><p>";
	echo "<Table width=100% border=1><TR><TD><B>RANK NUMBER</B></td><TD><B>PLAYER NAME</B></td><TD><B>PLAYER LEVEL</B></td></tr>";
	while ($toplvlrow = mssql_fetch_array($toplvlr))
	{
		$toplvl_num++;
		echo "<TR><TD>$toplvl_num</td><TD>".$toplvlrow[CharName]."</td><TD>".$toplvlrow[Level]."</td>";
		if ($toplvl_num >= 100) break;
	}
	echo "</table></p>";
?>
I can't say if the PhP works as it's not mine, but the SQL does. Hope this helps

credits to Mazdik & ihatehaxor
wallerus is offline  
Thanks
2 Users
Reply


Similar Threads Similar Threads
[Trading] Steam Account with CS:GO & more [Searching] Counter Strike Complete(as key or acc).
09/05/2014 - Counter-Strike Trading - 2 Replies
Games: Arma Cold War Assault Auditorium BioShock Burnout Paradise Castle Crashers Counter Strike Global Offensive (rank MGE 1 game to dmg) Crysis 2 Dead Space Dead Island Epidemic



All times are GMT +1. The time now is 18:01.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.