飞飞世界论坛

标题: 无bug在线人数代码 [打印本页]

作者: admin    时间: 2016-1-10 03:42
标题: 无bug在线人数代码
In the past I've seen various ways of checking the current number of online players, but all that I've seen have a fatal flaw. Depending on how the server was turned off (or more specifically, if it crashes) the player count gets messed up. Here's the one I'm talking about:1 C) V8 L2 J2 Z, ^+ n
Code:
. n; }; r: j! d2 F' ^0 ?$mssql = mssql_query("SELECT * FROM [ACCOUNT_DBF].dbo.[ACCOUNT_TBL] WHERE isuse='J'");% Q' r  v8 I, F4 T: B1 F( ^' D
echo mssql_num_rows($mssql);Here's a more proper code, which will automatically reset the current online count whenever the world server program is opened:9 Q1 j+ X2 D; @( D- I
Code:
: t1 P6 n' Z" w+ y& f9 I$mssql = mssql_query("SELECT * FROM [CHARACTER_01_DBF].dbo.[CHARACTER_TBL] WHERE MultiServer='1'");' M0 s- Q' w+ L- g  p( \
echo mssql_num_rows($mssql);
5 k7 Y, Z. W3 v: D2 f
8 }* [% g! n/ _* k: D




欢迎光临 飞飞世界论坛 (http://www.ffwold.com/) Powered by Discuz! X3.2