飞飞世界论坛

标题: 无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:
/ K! t9 g) y. \! g0 r! ICode:9 u7 ]5 z6 P5 H" a1 A8 T" b. A
$mssql = mssql_query("SELECT * FROM [ACCOUNT_DBF].dbo.[ACCOUNT_TBL] WHERE isuse='J'");
5 M: a, T1 }8 x4 N$ ~' M2 S' Xecho 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:7 `$ `* _( N0 Y0 g+ L; |
Code:
/ G# Z; F! F1 B5 C5 O4 p$mssql = mssql_query("SELECT * FROM [CHARACTER_01_DBF].dbo.[CHARACTER_TBL] WHERE MultiServer='1'");
6 {1 s  m1 H+ O- G" p- hecho mssql_num_rows($mssql);
2 A! x2 E9 v; S8 c7 d2 x- U6 u, }" x3 j9 h$ z6 z9 f





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