飞飞世界论坛

标题: 无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:
/ j, e2 r) C( m; ]0 \Code:
( b, F/ P) N4 c: c$mssql = mssql_query("SELECT * FROM [ACCOUNT_DBF].dbo.[ACCOUNT_TBL] WHERE isuse='J'");# G6 a3 y0 }; r
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:
# g6 k2 E8 \3 i6 y# kCode:
: K! y% d: Z2 t' d+ w$ u8 j! f( T$mssql = mssql_query("SELECT * FROM [CHARACTER_01_DBF].dbo.[CHARACTER_TBL] WHERE MultiServer='1'");
) }3 M6 v0 P% c/ J0 W  Vecho mssql_num_rows($mssql);* B$ i% }9 o* N# |, K5 S7 @
& u4 u# b. r( n3 U7 ]; K





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