EdenEternal Posted August 6, 2010 Posted August 6, 2010 Hello Guys Today i share Online Players Scripts + Face Pcs. for example in your servers is 30 players online and you set 20 to php config. script will shows 50 players (30 + 20). First Create config.php and write <?php $L2JBS_config["mysql_host"]="localhost"; // MySQL Host ["localhost"] $L2JBS_config["mysql_port"]="3306"; // MySQL Port ["3306"] $L2JBS_config["mysql_db"]="l2jdb"; // MySQL Database ["l2jdb"] $L2JBS_config["mysql_login"]="root"; // MySQL User ["root"] $L2JBS_config["mysql_password"]="master"; // MySQL Password ["root"] $facepcs="20"; // Count of Face PCs include("_config_procs.php"); error_reporting(0); ?> now create _config_procs.php and write <?php $link = mysql_connect($L2JBS_config['mysql_host'].":".$L2JBS_config['mysql_port'], $L2JBS_config['mysql_login'], $L2JBS_config['mysql_password']); if (!$link) die("Couldn't connect to MySQL"); @mysql_select_db($L2JBS_config['mysql_db'], $link); error_reporting(0); ?> Finaly Create and write <?php require("Config.php"); $activity = mysql_query("SELECT count(*) FROM characters WHERE online = 1"); $tmp = $activity + ($facepcs) - 4; { print 'Online players: <em>'.$tmp.'<em>'; } ?> Finish. Credits to me Quote
+cs.tribal Posted August 7, 2010 Posted August 7, 2010 thank you! i was searching for something like that! Quote
+cs.tribal Posted August 7, 2010 Posted August 7, 2010 thank you! i was searching for something like that! Quote
Apithanos Posted August 7, 2010 Posted August 7, 2010 thank you! i was searching for something like that! thank you! i was searching for something like that! stop making double post's dude :) btw the online players php are shared a lot of times :) Quote
EdenEternal Posted August 8, 2010 Author Posted August 8, 2010 stop making double post's dude :) btw the online players php are shared a lot of times :) [share] Online Players PHP Script + Face PCs Quote
SoRa Posted August 8, 2010 Posted August 8, 2010 Thank you Leki.It's a good share.Keep your good working and sharing. :) ;) Quote
yamimarik Posted August 12, 2010 Posted August 12, 2010 Finaly Create and write <?php require("Config.php"); $activity = mysql_query("SELECT count(*) FROM characters WHERE online = 1"); $tmp = $activity + ($facepcs) - 4; { print 'Online players: <em>'.$tmp.'<em>'; } ?> Finish. Credits to me How do I call? I tried to put it in _config_procs but error Parse error: syntax error, unexpected '[' in / var/www/test/test2/config.php on line 8 Warning: mysql_connect () [function.mysql-connect]: Access denied for user 'www-data' @ 'localhost' (using password: NO) in / var/www/test/test2/_config_procs.php on line 2 Could not connect to MySQL works on gracia epilogue? Quote
EdenEternal Posted August 16, 2010 Author Posted August 16, 2010 you do something wrong when editing config.php try one more.if you will got error show config.php and _config_procs.php Quote
Spiros Posted August 16, 2010 Posted August 16, 2010 Man write a simple php script. <?php $MySQL_Connection = mysql_connect("localhost", "root", root"); if($MySQL_Connection) { if(mysql_select_db("l2jdb", $MySQL_Connection)) { $MySQL_Action = "SELECT online FROM character WHERE online = 1"; $MySQL_Query = mysql_query($MySQL_Action, $MySQL_Connection); $Number_of_rows = mysql_num_rows($MySQL_Query); echo("Online players: $Number_of_rows); } else { echo("Wrong"); } } else { echo("Wrong"); } ?> A very simple online player script!!!! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.