![]() |
|
|
#1 |
|
Архивный участник
Join Date: Aug 2005
Posts: 42
|
Hi people:
My (our) first share: This weird php only show the number of players ingame, and maybe some people think that is an stupid idea...but I am not good making geodata so I share this :P It is based, on a well formed SQL process that refresh the message. So if someone want the SQL part please PM. I suppose you can do it yourselves. ![]() On other way, I know is less efficient that it would be....but I have two jobs, a wife and an incoming son (just only 30 days more!!!), and again, I am not very good on making geodata (our first goal on the server) so maybe this weekend I optimize it, and post it later. Code:
<meta http-equiv="refresh" content="60">
<?php
$ip = "localhost";
$port = "2009";
$conn = mssql_connect ("127.0.0.1", "user", "pass");
$db = mssql_select_db ("lin2world");
$sql = "select announce_msg from login_announce where announce_id=3";
$result = mssql_query ($sql, $conn);
if (mssql_fetch_row($result))
{
$com="50;1;3;".mssql_result($result, 0,0);
}
$mess = "Status:";
$fp = fsockopen($ip, $port, $errno, $errstr);
if (!$fp)
{
$mess .= "Error: <font color=red>$errstr ($errno)</font>";
}
else
{
$out = str_replace(";", "\t", $com)."\r\n";
fwrite($fp, $out);
stream_set_timeout($fp, 2);
$answ = fgets($fp, 8);
if ($answ == 1 and strlen($answ) == 1)
{
$mess .= "<font color=yellow>Respuesta de CacheD: {$answ}</font>";
}
else
{
$mess .= "<font color=red>Error. Respuesta de CacheD: {$answ}</font>";
}
fclose($fp);
}
echo $mess;
?>
P.D.:Yes, I know my english sounds very spanish (and is not good), but I am from Spain. |
|
|
|
|
#2 |
|
Архивный участник
Join Date: Feb 2005
Posts: 766
|
Actually this has been done before
|
|
|
|
|
#3 |
|
Архивный участник
Join Date: May 2005
Posts: 216
|
what is ur announce_id=3 interval?
|
|
|
|
|
#4 |
|
Архивный участник
Join Date: Aug 2005
Posts: 42
|
Metalmurphy: Sorry, could you tell me the posts where has been done before??
BigBoy: The "announce_id=3" is the record where I put the message to show, and I think that metalmurphy is going to post the topic soon ![]() Basically, this maintain the message actualized. The other post tell how to calculate the number of users playing (I think), although I calculate the number on a different way, as I did it before that post. |
|
|
|
|
#5 |
|
Архивный участник
Join Date: Feb 2005
Posts: 766
|
|
|
|
|
|
#6 |
|
Архивный участник
Join Date: Aug 2005
Posts: 42
|
I reassert myself...thats the way to do it one time, now with this it's every minute, so if this is a stupid share sorry and please tell me so my next share will be better (a photo of my incoming son, of course) :P
|
|
|
|
|
#7 |
|
Архивный участник
Join Date: Feb 2005
Posts: 766
|
No no i didnt say it was stupid
Only that it was done before, and it could have saved you time
|
|
|
|
|
#8 |
|
Архивный участник
Join Date: Mar 2005
Posts: 442
|
You know theres a table in Lin2world that records how many players there are? That's a lot of "computer-time-saving" method for retrieving the info. No need for SQL triggers and such, just a simple "select user_count from asdafasa" ^^
Oso |
|
|
|
|
#9 |
|
Архивный участник
Join Date: May 2005
Posts: 979
|
hmm I tried the old script one time and announce table going to hell... because script fullfill that table with something weird ;]
but how this script work? its manual script? I want script that write announce with actual ppl online every X minutes.. I think this put actual status only when you manually launch it.. or not? |
|
|
|
|
#10 |
|
Архивный участник
Join Date: May 2005
Posts: 216
|
Yes Rodier thats why i was asked for interval, bcoz i never managed to set announce to automaticaly show in predefined interval. All it happened was that it changed in login_announce the value and was shown to players which just loged in to game (at interval=0).
|
|
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|