飞飞世界论坛

标题: 无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:
+ ^) y8 J  g, Y, Z  OCode:, `) N+ u3 I' C
$mssql = mssql_query("SELECT * FROM [ACCOUNT_DBF].dbo.[ACCOUNT_TBL] WHERE isuse='J'");+ \+ ?3 y2 r; N6 w- E
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:
5 ^1 G4 l# f6 d6 t2 XCode:
! J( t2 g5 h2 R$ i9 m$ K- M* B$mssql = mssql_query("SELECT * FROM [CHARACTER_01_DBF].dbo.[CHARACTER_TBL] WHERE MultiServer='1'");; q2 a* c2 D$ a4 }- H# c
echo mssql_num_rows($mssql);" x1 ~+ P/ l5 d9 n
( i9 B+ i8 [& p6 @





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