Jump to content

Recommended Posts

Posted

hello guys i decided to share a cool code for online statistics and Announcements!

Its something simple.

 

online statistics

 

Adding to DB:

 

 

CREATE PROCEDURE [dbo].[playersnumber]
--@pl_number int output
AS
--SELECT @pl_number=count(*) FROM user_data WHERE login>logout AND logout>0 AND login>0
SELECT count(*) FROM user_data with (nolock) WHERE login>logout
GO

 

 

And here is the Script...(Php)

PHP Code:

<?php

$flogin = fsockopen ("000.000.000.000",2106, $errno, $errstr, 1);//Instead 000.000.000.000 Ip Server
        if ( $flogin )
                $login_s = "Online";
        else
                $login_s = "Offline";

$fgame = fsockopen ("000.000.000.000",7777, $errno, $errstr, 1);
        if ( $flogin )
                $game_s = "Online";
        else
                $game_s = "Offline";


$mssql_server="000.000.000.000"; //Instead 000.000.000.000 Ip Server
$mssql_db="lin2world";
$CONN = mssql_connect($mssql_server, 'user', 'pass');
if ($CONN) {
mssql_select_db($mssql_db);
$result = mssql_query("exec playersnumber", $CONN);
$online=mssql_fetch_row($result);
$online=$online[0];
}
else $on_line = 0;

//image size $im = imagecreate(X, Y);
$im = imagecreate(100, 45);
$str = "Online: ";
// $bg - the background color, $textcolor - text color
$bg = imagecolorallocate($im, 213, 248, 225);
$textcolor = imagecolorallocate($im, 0, 0, 0);

// Output lines in the picture
//imagestring($im, The font size for the X coordinate, coordinate, Y, "Login: ", $textcolor);
imagestring($im, 3, 0, 0, "Login: ", $textcolor);
imagestring($im, 3, 53, 0, $login_s, $textcolor);
imagestring($im, 3, 0, 15, "Game: ", $textcolor);
imagestring($im, 3, 53, 15, $game_s, $textcolor);
imagestring($im, 3, 0, 30, $str, $textcolor);
imagestring($im, 3, 53, 30, $online, $textcolor);
// output the image
header("Content-type: image/png");
imagepng($im);
imagedestroy($im);
?> 

 

 

Online Announcement

 

PHP Code:

 

 <?php 
DEFINE("SELECT_ONLINE","select count(*) from user_data where  account_id>0 and online=1"); 

function connectdb($db, $dbaddress, $dbuser, $dbpass){ 
$dbconnect = mssql_connect ($dbaddress, $dbuser, $dbpass); 
  mssql_select_db ($db, $dbconnect); 
  } 
   
connectdb('lin2world', '172.16.192.34', 'sawa', 'dfsdfFdvh'); 
$result = mssql_query(sprintf(SELECT_ONLINE)); 
$accounts = mssql_fetch_array($result); 
$accounts = trim($accounts[0]); 


send_announce("Now online: ".$accounts." users"); 

exit; 


function send_announce($announce){ 
$buf=pack("c",70).tounicode($announce); 
$cachedsocket=@fsockopen("172.16.192.3","2012",$errno,$errstr,1) or die($notconnected); 
fwrite($cachedsocket,pack("s",(strlen($buf)+2)).$buf); 
$len=unpack("v",fread($cachedsocket,2)); 
$rid=unpack("c",fread($cachedsocket,1)); 
  for($i=0;$i<(($len[1]-4)/4);$i++){ 
    $read=unpack("i",fread($cachedsocket,4)); 
      $rs.=$read[1]; 
       } 
       fclose($cachedsocket); 
} 


function tounicode($string){ 
  $rs=""; 
  for($i=0;$i<strlen($string);$i++) 
  $rs.=$string[$i].chr(0); 
  return($rs.chr(0).chr(0)); 
} 
?> 

 

Thats all!If i made mistakes let me know!

 

More shares soon

Posted

I don't think it's a good way to define an "online" player:

SELECT count(*) FROM user_data with (nolock) WHERE login>logout

Same here:

DEFINE("SELECT_ONLINE","select count(*) from user_data where  account_id>0 and online=1"); 

I mean... It works in 99% of the cases, but the results can be random, count crashed players etc.

 

Regards,

Tomoya of L2Sublimity

 

Posted

The hAuthD script works with any hAuthD version, and for what i know any server works with hAuthD.

 

hAuthd doesn't support Auto Registration - like GF AuthDaemon \  AuthGate does.

 

So there's that niche possibilty.

Posted

hAuthd doesn't support Auto Registration - like GF AuthDaemon \  AuthGate does.

 

So there's that niche possibilty.

GF doesn't support it as well, it was some crap added by some of the previous owners of the files, not NcSoft, its just a stored procedure that has to me modified in order to disable that function. But we are talking about online status and players, what has to do that with ?

Posted

GF doesn't support it as well, it was some crap added by some of the previous owners of the files, not NcSoft, its just a stored procedure that has to me modified in order to disable that function. But we are talking about online status and players, what has to do that with ?

 

hAuthd script only works with hAuthd.

And you try use the modified GPwdWithFlag with hAuthd tell me what happens.

 

Thus a similar script like this is needed - in those niches.

Posted

I know but we were talking about online and offline scripts, not about auto-registration :D I was talking about the hAuthD script for online and offline status, beacause its the Auth that most people use.

The only thing that needs to be removed in that SP for deactivating the Auto-Registration feature is exec ap_AutoReg @account thats all, anyway  extending other Auth like C4 there is a posibility of adding such feature.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • I am very satisfied, wonderful work and trustworthy, thank you for my logo.
    • ✔ We offer more services than listed. Prices of goods may vary depending on country, warranty, phone number, and other factors. We are available 24/7. ⠀⠀⠀⠀⠀⠀⣀⣠⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⣴⡿⠋⠉⠉⠻⢿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠹⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠈⣿⡄⠀⠀⠀⠀⠀⠀⢸⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠸⣷⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⢀⣀⣀⣀⣀⣀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⢻⣇⠀⠀⠀⠀⠀⢸⣿⣿⡿⠿⠿⠟⠛⠛⠻⢿⣿⣶⣄⠀⠀⠀ ⠀⠀⠀⠀⠀⢈⣿⠆⠀⠀⠀⠀⠀⠀⠀⠀⣀⣠⣤⣤⣤⣤⠀⠈⠻⣿⣇⠀⠀ ⠀⠀⠀⠀⢀⣾⡏⠀⠀⠀⠀⠀⠀⠀⣴⡿⠋⠉⠀⠀⠀⠀⠀⠀⠀⢹⡿⠀⠀ ⠀⠀⣀⣤⣼⣿⠀⠀⠀⠀⠀⠀⠀⢸⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⣷⣄⠀ ⢠⣾⠟⠋⠉⠋⠀⠀⠀⠀⠀⠀⠀⠈⣿⣦⣀⣀⣀⣤⣤⣶⣶⠿⠋⠁⢹ ⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⡟⢉⣿⠋⠉⠉⠉⠁⠀⠀⠀⠀⢸⣿⠀ ⢸⣿⠀⠀⠀⠀⠀⢀⣀⣀⣤⣴⠿⠋⠀⠘⣷⡀⠀⠀⠀⠀⠀⠀⢀⣴⣿⠏⠀ ⢸⣿⡄⠀⠀⠀⠀⠈⠉⠉⠁⠀⠀⠀⠀⠀⣸⣿⢶⣤⣤⣴⡶⠿⠛⠙⣿ ⠈⣿⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⣽⣿⠀ ⠀⠘⣿⣆⠀⠀⠀⠀⣠⣤⡀⠀⠀⠀⠀⠈⠻⣧⣀⡀⠀⠀⠀⣀⣠⣴⡿⠇⠀ ⠀⠀⠘⢿⣿⣦⣤⣴⡿⠻⠿⣷⣦⣤⣤⣤⣴⣾⣿⡿⠿⠿⠿⠟⠛⠉⠀⠀⠀ ⠀⠀⠀⠀⠀⠀
    • Frozen is more popular coz adm can edit npc from client side and no need dig in xml and etc  )
    • Your work is as good as your arrogance. If you didn't break 10 systems to fix 1, I would recommend aCis. Yes, I use aCis and I fixed a lot of things that you left aside to reorganize and rename things. You insist on recommending your broken public project. Don't do that because there are many people who dream of owning a server, and in aCis 409 every dream is broken. I've seen many people break things by using this. aCis 409 doesn't work at the basics. Water movement and flying movements are broken, which is the basics. Seven Sings is completely broken, Sieges need fixing, and worst of all, level 3 and 4 clan quests are bugged, besides other quests that you intentionally broke and still recommend. You are an excellent programmer, but your arrogance in feeling superior to everyone is killing you. Happy New Year to you, and be more transparent and honest when recommending this. I'm not sharing the corrections I made, nor my Geodata system, precisely because of your arrogance. I'll soon post a video of my Geoengine system, which you spent 12 years on and didn't finish. I can send you a list of everything you need to fix, but you're too arrogant for that because you're a superior God and don't accept advice from mortals.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock